I am trying to re-do everything on my site so it is all neat and organized code, which includes re-doing my css. I have realized a problem that can be overcome in other ways but it would be easier if I could do it here.
Here is some of my css:
Firstly, my div's (#left_menu and #content) are not 100% height. Everywhere just says make sure the body and parent div is height 100% and all is good, however this is not working in my case.
Second, I have noticed a very annoying problem which is if I have padding / borders / margins and use width 100% / height 100% it simply adds it on to the body width / height. Let me explain: The body is 1024px. If I have the #header width as 100% it works fine. If I add a 2px border it is 1028px wide (100% + 4px). Is there a way to have the 100% include the 2px, or do you have to do nested div statements?
Thanks for your help.
Here is some of my css:
Code:
body {
font: 12px Verdana, Arial, Helvetica, sans-serif;
background: #000000 url(top_bg.png) repeat-x;
height: 100%;
width: 1024px;
margin: 0 auto;
padding: 0;
behavior: url("../csshover3.htc");
}
#header {
width: 100%;
margin: 0;
padding: 0;
background: silver;
text-align: center;
}
#content_wrapper {
height: 100%;
width: 1000px;
margin: 20px 0;
padding: 10px;
border: gray groove 2px;
background: silver;
display: block;
overflow: hidden;
}
#left_menu {
height: 100%;
width: 150px;
float: left;
padding: 5px;
border: black groove 2px;
}
#content {
width: 668px;
float: left;
padding: 0;
border: black groove 2px;
}
#footer {
width: 1000px;
margin: 0;
padding: 5px 12px;
background: silver;
}
Second, I have noticed a very annoying problem which is if I have padding / borders / margins and use width 100% / height 100% it simply adds it on to the body width / height. Let me explain: The body is 1024px. If I have the #header width as 100% it works fine. If I add a 2px border it is 1028px wide (100% + 4px). Is there a way to have the 100% include the 2px, or do you have to do nested div statements?
Thanks for your help.
Comment