Drew Martin wrote:
The page at the below URL renders perfectly in IE6, but is failing horribly
in Firefox (0.7, 0.8). I can't figure out why and was hoping someone could
take a quick look at it. Most of the layout is done through the use of
floats.
HTML file: http://superdisco.net/css/index.html
CSS file: http://superdisco.net/css/sd.css
The gray and maroon backgrounds are to highlight the layout used.
Any ideas on how I can get the page to display correctly in Firefox?
1. IE does not know XHTML
2. Using the XML Declaration puts IE 6 into Quirks Mode.
3. Removing the XML Declaration puts IE 6 into Standards Mode.
4. A suggestion is to place notes into your stylesheets. It helps you to
debug.
5. I have made changes to make your styles work. I may have approached
it differently, depending on what you had in mind.
6. Look over the notes that I have placed in the modified stylesheet below.
7. IE calculates widths differently, therefore some differences.
8. Read up on the box model and floats in particular.
9. Try the following modified stylesheet:
10. WFM in IE and Moz.
11. Does not work in Opera. It seems that Opera does not support
display:inline-block.
12. Perhaps someone else will help further.
=====
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
background-color: #004477;
color: #FFFFFF;
font-size: 80%;
text-align: center;
line-height: 13pt;
}
#frame { /* Over-All Wrapper */
width: 750px;
text-align: left;
border: 2px solid #000;
margin-left: auto;
margin-right: auto;
padding: 0; /* changed 0px; to 0; */
}
#navcontainer { /* wrapper for Navs and Image 1 & 2 */
/* display: inline; removed, needs to be the default of block */
background-color: Gray;
float: left; /* removes the box out of normal flow */
width: 150px;
padding-left: 3px;
padding-right: 3px;
font-size: 12px;
font-weight: bold;
margin: 0; /* changed 0px; to 0; */
}
#maincontainer { /* wrapper for Banner, Tiles, Contents */
display: inline-block; /* changed from inline to inline-block */
background-color: Maroon;
/* float:right; !!!drops it down below navs */
/* width: 100%; ??? */
/* padding-left: 3px; removed left and right padding
padding-right: 3px; and used shorthand with adjustments */
padding:1px 3px 1px 3px;
font-size: 12px;
font-weight: bold;
margin: 0;
margin-left:156px; /* to clear navcontainer 3+150+3=156 */
}
#banner, #tiles, .content { /* Banner, Tiles and Contents */
/* display: block; not needed - is so by default */
padding: 3px;
background-color: #116699;
border: 1px solid #fff;
margin-top: 5px; /* changed from 6px; to 5px; to */
margin-bottom: 5px; /* compensate for the 1px border */
}
#navcontainer .navheader, #navcontainer a { /* Link Visited & Hover */
display: block; /* states */
padding: 3px;
background-color: #116699;
border: 1px solid #fff;
margin-top: 6px;
margin-bottom: 6px;
}
#navcontainer .navheader, #navcontainer a { /* this is not needed */
/* width: 100%; ??? */
}
#navcontainer a:link, #navcontainer a:visited {
color: #FFF;
text-decoration: none;
}
#navcontainer a:hover {
background-color: #4499CC;
color: #FFF;
}
#buttonstrip { /* for Image 1 and Image 2 */
text-align: center;
}
#banner { /* Home box */
font-weight: bold;
text-align: center;
/* width: 100%; ??? */
margin-right: 135px; /* added to clear the tiles */
}
#tiles { /* box for tile 1-5 */
/* margin-left: 6px; "broken?" NO, applied margin to banner */
float: right;
width: 127px; /* IE needs 1+25x5+1=127 */
font-weight: bold;
text-align: center;
/* padding-left: 0px; these 4 declaration removed
padding-right: 0px; and replaced with shorthand
padding-top: 0px; padding: 0;
padding-bottom: 0px; */
padding: 0;
margin-top: 4px; /* added margin to line up tiles */
height: 25px;
}
..content { /* are the two Contents boxes */
/* clear: both; THIS CLEARS AND PLACES IT UNDER NAVS */
/* display: block; not needed - is so by default */
/* width: 100%; ??? */
font-size: 100%;
margin-top: 6px;
}
..bullets { color: #CCCCCC; } /* are the .::.:. and :: */
#tile1 { /*tile 1-5 are the shaded small boxes*/
float: left;
background-color: #004475;
width: 25px;
height: 23px;
}
#tile2 {
float: left;
background-color: #5e96bf;
width: 25px;
height: 23px;
}
#tile3 {
float: left;
background-color: #98c3dc;
width: 25px;
height: 23px;
}
#tile4 {
float: left;
background-color: #cee1eb;
width: 25px;
height: 23px;
}
#tile5 {
float: left;
background-color: #ffffff;
width: 25px; /* typo?? changed 23px; to 25px; */
height: 23px;
}
=====