I find it awkward to create layouts like this that have good semantics.
The left side is a column about 150 pixels wide which contains navigation elements.
I would like to put the HTML for this section of the site at the beginning of the HTML code, and then have an easy way to force the rest of the page not to encroach on that territory on the left (the 150 pixel column).
I have thought about some options.
Are there other options that are more suitable for this task?
Here are the cons.
height:9999999px;
? That makes my page 10 million pixels high and the scrollbar is now useless.Create sidebar:
<!-- html -->
<nav role="main">
<a href="link.com">link</a>
</nav>
//css
nav{
width: 150px;
float: left;
display: inline;
margin: 0;
padding: 0;
margin-right: 10px;
}
Then create a container for your main content
<!-- html -->
<section id="main">
main content in here
</section>
//css
section#main{
width: 500;
float: left;
margin: 0;
padding: 0;
display: inline;
}
As long as you place nav before section in your source code, anything that is in the section will stay away from the left hand column and will not wrap under it.
Just need to make sure you reset all your css, especially paddings, margins and borders unless you know what you're doing
good luck
I have always used option 1, though if there are other ideas out there, I'd love to hear about them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With