CSS div height 100%

J

jaschreiber

i'm writing this only because i spent a good two days endlessly trying
to solve this problem and couldn't find anything on the internet that
actually helped. I eventually figured out the solution, as no doubt so
does everyone (hence the solution never actually being posted: it seems
too obvious to bother)... but had i found it sooner, i would have been
happy, so here goes:

if you're trying to get a CSS div to span the total height of the
window and scrolling is likely to be involved (for instance, a menu
sidebar), don't use the height: 100% tag! set margin-top: 0px and
margin-bottom:0px.
 
D

dorayme

i'm writing this only because i spent a good two days endlessly trying
to solve this problem and couldn't find anything on the internet that
actually helped. I eventually figured out the solution, as no doubt so
does everyone (hence the solution never actually being posted: it seems
too obvious to bother)... but had i found it sooner, i would have been
happy, so here goes:

if you're trying to get a CSS div to span the total height of the
window and scrolling is likely to be involved (for instance, a menu
sidebar), don't use the height: 100% tag! set margin-top: 0px and
margin-bottom:0px.

Why use any height at all?
 
P

pecan

i'm writing this only because i spent a good two days endlessly trying
to solve this problem and couldn't find anything on the internet that
actually helped. I eventually figured out the solution, as no doubt so
does everyone (hence the solution never actually being posted: it seems
too obvious to bother)... but had i found it sooner, i would have been
happy, so here goes:

if you're trying to get a CSS div to span the total height of the
window and scrolling is likely to be involved (for instance, a menu
sidebar), don't use the height: 100% tag! set margin-top: 0px and
margin-bottom:0px.

Thank you. I was having problems like that, and also didn't get an
answer on another news group. Now you've solved it for me.

CM
 
N

Neredbojias

To further the education of mankind, (e-mail address removed) vouchsafed:
i'm writing this only because i spent a good two days endlessly trying
to solve this problem and couldn't find anything on the internet that
actually helped. I eventually figured out the solution, as no doubt so
does everyone (hence the solution never actually being posted: it seems
too obvious to bother)... but had i found it sooner, i would have been
happy, so here goes:

if you're trying to get a CSS div to span the total height of the
window and scrolling is likely to be involved (for instance, a menu
sidebar), don't use the height: 100% tag! set margin-top: 0px and
margin-bottom:0px.

Hmm. What if you just don't want any horizontal margins on the div?
 

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,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top