Layout using CSS: create vertical line

A

Alex

Hi

Please see http://www.alex-myly.ch/css_testpage.html for the testpage
I created to solve and demonstrate my problem

I would like to create a page with a top header and a footer which
always sticks to the bottom of the Viewport or the bottom of the page
(whichever is lower).

Between header and footer there are two columns (left sidebar and main
content). left sidebar and main page should be separated by a full
screen vertical line. The line has to go all the way done to a few
pixels above the footer.

I found a tutorial to have to footer problem solved. But I can't
manage to create the vertical line.

I applied some ugly coloring to my page so you can see which div is
taking which part of the page.

For me the problem seems to be the "content". In CSS it has
min-height: 100% and height : auto but it does not take all the
remaining height of it's parent.
When I assign a absolute value to content's height (say 600px) sidebar
and contentMain will grow accordingly.

Can someone help me and tell me what I am missing?

I am testing with latest FireFox and Opera.

Here is my page layout:
Code:
<html>
<body>
<div id="page">
<div id="nonFooter">
<div id="header">
</div> <!-- header -->

<div id="content">
<div id="left_sidebar">
</div> <!-- left_sidebar -->

<div id="contentMain">
</div> <!-- contentMain -->

</div> <!-- content -->

</div> <!-- nonFooter -->

<div id="footer">
</div>
</div> <!-- page -->
</body>
</html>

Thanks for any hint

Alex
 
S

scripts.contact

I would like to create a page with a top header and a footer which
always sticks to the bottom of the Viewport or the bottom of the page
(whichever is lower).

fixed positioning
Between header and footer there are two columns (left sidebar and main
content). left sidebar and main page should be separated by a full
screen vertical line. The line has to go all the way done to a few
pixels above the footer.

use border-left in main content and/or border-right in sidebar
e,.g border-left:2px solid black
For me the problem seems to be the "content". In CSS it has
min-height: 100% and height : auto but it does not take all the
remaining height of it's parent.

try height:100%
 
B

Ben C

fixed positioning

That can be used to make it stick to the bottom of the viewport, but not
to the bottom of the page unless that happens to be at the bottom of the
viewport itself.
use border-left in main content and/or border-right in sidebar
e,.g border-left:2px solid black


try height:100%

But that won't let the height be taller than the viewport if the content
is. OP needs to post a URL. min-height: 100% and height: auto is a
possible way to go, but the problem might be with containing block
height-- it may be that adding html, body { height: 100%; } is what's
needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top