Hi,
When you want 100% wide elements don't float them and just remove the width and then you can add padding and borders as required. If an element is 100% wide then it should not be floated as there is no real need and floating everything can cause problems in older browsers.
Here:
Code:
.main .seventy {
float: left !important;
width: 100% !important;
}
The above is 100% wide but has 3px white borders so is 6px too large.
Just change it to:
Code:
.main .seventy {
float:none !important;
width:auto !important;
}
In your other page you have floated he element without a width so the borders do not push wide.
Code:
.main .hundred {
background-color: #D4D3DF;
border: 3px solid white;
float: left;
However that is a flawed approach also as floats are only as wide as the content they hold and so on a page with not enough text to reach the other side the element remains narrow and the background would not reach all the way across. This is another case of inappropriate floating.
Only float elements that need to be floated. If they are 100% wide then they don't need to be floated and the width can be auto and thus borders and padding are no problem.
If on the other hand you have two columns that you want to add up to 100% then the secret is again to only float one column with the appropriate width and let the other column be non floated and take up the available space (either use a margin-left to clear the float or use overflow:hidden to create a rectangular block to the side of the float).
In cases where you have to make things add up to 100% then use an inner element to hold the padding and borders or use box-sizing (modern browsers) to use the old box model where width padding and borders are kept on the inside.
Bookmarks