I'm new to HTML & CSS and one of my first steps is creating a normal layout like
/----------------\
| Header |
|----------------|
| N | |
| a | Content |
| v | |
|----------------|
| Foot |
\----------------/
In order to be flexible, Navs width shouldn't be fixed and the Content should never float around it. In other words, Nav and Content should behave like table columns just that the use of tables for formatting are a big no no in HTML. My current code looks like this:
<!DOCTYPE html>
<html>
<head>
<title>Todo list</title>
<style type="text/css">
nav {
float: left;
padding-right: 5px;
margin-right: 5px;
background: yellow;
height: auto; /* auto | inherit | 100% */
width: auto;
}
#content {
margin: 5px;
padding-left: 5px;
}
header {
background: blue;
}
footer {
clear: both;
background: #ccc;
}
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
</style>
</head>
<body>
<header>
Head
</header>
<nav id="main_nav">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/contact">Contact (p)</a></li>
<li><a href="/temp">Temp</a></li>
</ul>
</nav>
<div id="content" class="clearfix">
<h1>Test</h1>
<h2>A</h2><h2>C</h2><h2>D</h2>
</div>
<footer>
<p>[Copyright bumf]</p>
</footer>
</body>
</html>
Which results in
Most solutions I found used either a fixed width for Nav or for the Content margin, which isn't a clean. It seems that CSS Multi-column Layout Module or CSS Flexible Box Layout Module could help, but they are both "Candidate Recommendation" so I can't use them safely. What's the proper way to solve my problem?