Doctype CSS problem in Firefox

Discussion in 'HTML & Website Design' started by larssonk22, Apr 10, 2009.

  1. #1
    I am redoing my site so that its W3 validated, I'm stuck on the final error!

    Basically when I have the doctype in the html it validates with no problems however viewing the site in firefox the site looks like this - see image below
    (key: 1=header, 2=navigation, 3=maincontent, 4=footer)

    [​IMG]
    The content (3) wraps around the navigation, and ignores the padding rules I have inserted in the CSS instead of looking like image below which is how the page appears if I remove the doctype.

    [​IMG]

    I was thinking that I could try and get the navigation menu(2) to just fit the entire length of the page to avoid this, but I cannot figure out how to do it.
     
    larssonk22, Apr 10, 2009 IP
  2. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #2
    It looks like that compared to what? Firefox has no issues with anything you mentioned and should be your reference for how things work for what you wrote. But without showing your complete markup, anything we say would be only a wild guess.
     
    drhowarddrfine, Apr 10, 2009 IP
  3. sudharsan

    sudharsan Active Member

    Messages:
    164
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    post your css code or your website link
     
    sudharsan, Apr 10, 2009 IP
  4. larssonk22

    larssonk22 Well-Known Member

    Messages:
    236
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #4
    my bad, PM sent
     
    larssonk22, Apr 10, 2009 IP
  5. larssonk22

    larssonk22 Well-Known Member

    Messages:
    236
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #5
    here is a link to the site page: 4d-ultrasoundscan.co.uk/4D-Scan.htm

    (dont forget to add the "www.")

    here is my css code (it needs some tidying but I will get round to that later)

    @charset "utf-8";
    
    a {text-decoration: none; }
    a:link.TextLink			{color: #666666; text-decoration:none;}
    a:active.TextLink		{color: #666666; text-decoration:none;}
    a:hover.TextLink		{color: #3770B7; text-decoration:underline;}
    a:visited.TextLink		{color: #666666; text-decoration:none;}
    a:hover.TextLink		{color: #3770B7; text-decoration:underline;}
    
    body  {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 0.8em;
    	background: #FFF;
    	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
    	padding: 0;
    	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
    	color: #000000;
    	}
    h1 {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 1.5em;
    	color: #3770B7;
    	font-weight: bold;
    	margin-top: 10px;
    	margin-bottom: 3px;
    	}
    h2 {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 1.2em;
    	color: #3770B7;
    	font-weight: bold;
    	margin-top: 10px;
    	margin-bottom: 3px;
    	} 
    h3 {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 1.2em;
    	color: #FF9900;
    	font-weight: bold;
    	margin-top: 10px;
    	margin-bottom: 3px;
    	} 
    .c4 {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 1.5em;
    	color: #FF9900;
    	font-weight: bold;
    	margin-top: 0px;
    	margin-bottom: 3px;
    }
    .quotes {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 1.1em;
    	color: #3770B7;
    	font-weight: bold;
    	margin-top: 0px;
    	margin-bottom: 3px;
    	text-align: center;
    }
    .title {
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 1.1em;
    	color: #3770B7;
    	font-weight: bold;
    	margin-top: 0px;
    	margin-bottom: 3px;
    	
    }
    .twoColFixLtHdr #container {
    	width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
    	background: #FFFFFF;
    	margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
    	border: 1px solid #;
    	text-align: left; /* this overrides the text-align: center on the body element. */
    	border: 1px solid #d2d1d1;
    } 
    .twoColFixLtHdr #header { 
    	background: #; 
    	padding: 0 0px 0 0px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
    } 
    .twoColFixLtHdr #header h1 {
    	margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
    	padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
    }
    .twoColFixLtHdr #sidebar1 {
    	float: left; /* since this element is floated, a width must be given */
    	width: 165px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
    
    	background: #; /* the background color will be displayed for the length of the content in the column, but no further */
    	padding: 0px 0px 0px 0px;
    	border: 1px solid #d2d1d1;
    }
    .twoColFixLtHdr #mainContent {
    	margin: 0 2 0 170px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
    	padding: 0 10px;
    	line-height: 1.2;
    	
    } 
    .twoColFixLtHdr #footer { 
    	padding: 0 0px 0 0px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
    	background-image: url("images/onestop_logo.jpg"); background-repeat: no-repeat;
    	
    } 
    .twoColFixLtHdr #footer2 {
    	padding: 0 0px 0 0px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
    	height: auto;
    	padding: 0px 0px 0px 0px;
    	font: 100% Verdana, Arial, Helvetica, sans-serif;
    	font-size: 9px;
    	color: #FFF;
    	background: #8FBEEC;
    	text-align: center;
    
    	margin-top: 0px;
    	
    } 
    .twoColFixLtHdr #footer p {
    	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    	padding: 5px 5px 35px 5px; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    	font-size:8.0pt; text-align: right;
    } 
    .twoColFixLtHdr #footer3 p {
    	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    	padding: 5px 5px 35px 5px; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    	font-size:9px; text-align: center;	
    }
    .twoColFixLtHdr #footer2 p {
    	margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
    	padding: 0px 10px; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
    	font-size:7.0pt; text-align: centre;
    }
    .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    	float: right;
    	margin-left: 8px;
    }
    .fltlft { /* this class can be used to float an element left in your page */
    	float: left;
    	margin-right: 8px;
    }
    .clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
    	clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    }
    
    
    #button {
    	width: 165px;
    	padding: 0 0 1em 0;
    	margin-bottom: 1em;
    	font-family: 'Verdana';
    	font-size:8.0pt;
    	background-color: #FFFFFF;
    	color: #333;
    	}
    #button ul {
    		list-style: none;
    		margin: 0;
    		padding: 0;
    		border: none;
    		}
    		
    	#button li {
    		border-bottom: 1px solid #7aa0cf;
    		margin: 0;
    		}
    #button li a {
    		display: block;
    		padding: 3px 3px 3px 0.5em;
    		background-color: #FFFFFF;
    		color: #575757;
    		text-decoration: none;
    		width: 100%;
    		}
    
    	html>body #button li a {
    		width: auto;
    		}
    
    	#button li a:hover {
    		background-color: #2586d7;
    		color: #fff;
    		}
    
    .twoColFixLtHdr #contactbox {
    	width: 575px;
    	height: 445px;
    	background-image: url("images/bump_form.jpg");
    	margin: 10px 0px 0 0px; /* the auto margins (in conjunction with a width) center the page */
    	padding: 0px 0px 0px 5px;
    	margin-top:5px;
    	border: 1px solid #d2d1d1;
    	text-align: left; /* this overrides the text-align: center on the body element. */
    	border: 1px solid #d2d1d1;
    } 
    
    Code (markup):
     
    larssonk22, Apr 11, 2009 IP
  6. larssonk22

    larssonk22 Well-Known Member

    Messages:
    236
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #6
    here is a link to a page that doesnt have the doctype you can see the contents aligns perfectly.

    4d-ultrasoundscan.co.uk/pregnancy-social-network.htm - add the "www."

    I have been review the first page again, I do not made that it wraps around the navigation menu anymore, but it would look better if it didnt touch and there were 5 or 10px space between.
     
    larssonk22, Apr 11, 2009 IP
  7. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #7
    Sorry. I'm out of town till Monday. Do not bother with the page without the doctype. Not using a doctype doesn't make sense so don't bother.
     
    drhowarddrfine, Apr 11, 2009 IP