Forum Moderators: not2easy

Message Too Old, No Replies

CSS layout question

         

djclark

10:33 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



I was reading an article a while ago about structuring your html code so that the content is always up top and nav undernearth no matter what the ui looks like (e.g. in the ui the nav could be on the left or above the content it should not matter, only matter with the html). This then helped search engines find your content more efficiently and thus get a higher ranking.

my question is how can i structure the html so that my ui has the nav on top, content in the middle then footer below...

as i would normally do the following
<div id="Container">
<div id="NavBar"></div>
<div id="Content"></div>
<div id="Footer"></div>
</div>

what css do i need so my html will loook like

<div id="Container">
<div id="Content"></div>
<div id="NavBar"></div>
<div id="Footer"></div>
</div>

Is it possible?

jetboy_70

11:13 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



You'll need to know the height of NavBar ...

#navbar {
height: 60px;
top: 0;
position absolute;
}

#content {
top-margin: 60px;
position: relative;
}

#footer {
position: relative;
}

You can fill in the blanks yourself, but hopefully you can see the principal. If you position NavBar absolutely it takes it out of the document flow, but you need to push the other elements down to make space for it.

djclark

11:40 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Just what i was after, thanks for the help

finished results.

<style type="text/css">
<!--
#navbar {height:60px; width:396px;top:0; position:absolute; border:2px green solid;}
#content {margin-top:60px; position: relative;border:2px yellow solid; }
#footer {position: relative; border:1px black solid;}
#Container{width:400px; border:3px red solid; position:relative;}
-->
</style>
</head>
<body>
<div id="Container">
<div id="content">content in here</div>
<div id="navbar">Nav items...</div>
<div id="footer">footer</div>
</div>