We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10076
    • 1,024 Posts
    what a strugle CSS can be,

    I am for fun building a site but can notunderstand where the prblem is.
    The "wrapper" does not wrap in FF, it does in IE7. My IE6 machine broke down so could not verify IE6.
    But very curious to see if someone spots the error?

    My CSS:

    *{margin: 0; padding: 0;
    	font-family: "HelveticaNeue-Light", "Helvetica Neue Light", Helvetica, "Trebuchet MS", Verdana, sans-serif;
    	text-decoration: none;	font-size: 14px;
    }
    
    body {display: table;
    background-color:#ffffff;
    margin: auto;
    }
    
    #wrapper {
    	background-color: transparent;
    	width: 805px;
    	color: #000000;
    	margin: 0 auto;
    	padding:0; 
    	position: relative;
    display: block;
    }
    
    #topfc {
    	height: 20px;
    	width: 805px;
    	background-color: #fff;
    	position: relative;
    
    }
    
    #top {
    	height: 150px;
    	width: 803px;
    	background-image: url(../../images/mmc/images/topbg.jpg);
    	border-right: solid 1px #cccccc;
    	border-left: solid 1px #cccccc;
    	border-right: solid 1px #cccccc;
    	border-top: solid 1px #cccccc;
    }
    
    #navmain {
    	height: 22px;
    	width: 800px;
    	border-right: solid 1px #cccccc;
    	border-left: solid 1px #cccccc;
    
    }
    #leftfc {
    	height: 100%;
    	width: 20px;
    position: relative;
    	float: left;
    }
    
    #midfc {
    	height: 80%;
    	width: 20px;
    	position: relative;
    	float: left;
    }
    #contentwrapper {
    	clear:both;
    	height: 100%;
    	width: 803px;
    	border-right: solid 1px #cccccc;
    	border-left: solid 1px #cccccc;
    	position: relative;
    
    	border-bottom: solid 1px #cccccc;
    }
    
    .breadcrumbs  {
    	height: 30px;
    	width: 800px;
    	float: left;
    	background : #fff;
    	border-right: solid 1px #cccccc;
    	border-left: solid 1px #cccccc;
    	font-size: 3px;
    	padding-top: 5px;
    	padding-left: 5px;
    }
    
    
    #maincontent {
    display: block;
    float: left;
    position:relative;
    	width: 540px;
    	height: 100%;
    	padding-top: 20px;
    
    }
    
    
    
    #rightfc {
    	height: 100%;
    	width: 20px;
    	position: relative;
    	float: right;
    }
    
    
    #news {
    	width:220px;
    	height: 100%;
    	position: relative;
    	float: right;
    	background-color: transparent;
    	padding-top: 10px;
    	font-size: 10px;
    }
    
    
    #footerfc {
    	height: 20px;
    	width: 805px;
    	border: solid 0px #cccccc;
    	position: relative;
    	float: left;
    }
    #footer {
    	width: 805px;
    	height: 30px;
    	position: relative;
    	float: left;
    	text-align: center;
    	padding-top:23px;
    	color: #989594;
    		clear:both;
    }
    			


    My HTML:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
      <base href="[(site_url)]" />
      <title>Velocette Demo</title>
      <link href="assets/templates/mmc/common.css" rel="stylesheet" type="text/css" />
      <link href="assets/templates/mmc/menu.css" rel="stylesheet" type="text/css" />
    
    
       <script src="[(base_url)]/manager/media/script/scriptaculous/prototype.js" type="text/javascript"></script>
      <script src="[(base_url)]/manager/media/script/scriptaculous/scriptaculous.js" type="text/javascript"></script>
    
    
    </head>
    <body>
    <div id="wrapper">
      <div id="topfc"></div>
    	 <div id="top"></div>
    	    <div id="navmain">[[Wayfinder? &startId=`23` &level=`3` &parentClass=`hide` &parentRowTpl=`cssplay_parentRow` &outerTpl=`cssplay_outer` &innerTpl=`cssplay_inner` &rowTpl=`cssplay_row` &outerClass=`menu` &cssTpl=`cssplay_dropdown`]] </div>
    
    <div id="contentwrapper">cont wrapper
     <div id="leftfc"></div>
       <div id="midfc"></div>
        <div id="maincontent">[*#content*]</div>
         <div id="rightfc"></div>  
           <div id="news">wat doe jij nou hier</div>
    </div>
    	
    <div id="footerfc"></div>
      <div id="footer">ik hang een beetje te footeren</div>
    </div>
    </body>
    </html>
    
    
    


    I am using *fc" div´s as spacers (rightfc etc), so I can avoid margins. Maybe not a brilliant idea,just a test.

    Check page on: http://www.smashit.it/index.php?id=43

    Hope someone spots the error,

    best, fr.
      • 33372
      • 1,611 Posts
      I’ve only skimmed your code, but it sounds as if you’re just experiencing the typical Firefox behavior of not extending a wrapper div below floated content divs (which are considered to be outside of the layout). Most people add clearing divs just below their floated content divs (inside the wrapper), although you should also be able to use display:table on the wrapper div or insert a <br clear="all" /> after the floated divs. If that’s not it then I guess I’ll have to look a little bit closer to see what might be going on...
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 27708 MODX Staff
        • 2,502 Posts
        Looking at this site from Firebug (the Firefox Addon) you have some wonky formatting. First you have display:table; as a property and value for the body element. To do a centered layout that is cross-browser compatible you should just assign a width to your container #wrapper and then use margin:0px auto; as the property/value to center it in the pane.

        In addition you can either do a search on Google for clearfix or look at incorporating BluePrint CSS into your design as a basis for your CSS. The clearfix is built in to it. Another way you can deal with getting your wrapper to extend to contain all the sub elements is to place an <hr> in the wrapper before the footer and give it the following property/value combination: height:0; display:none; clear:both;

        If these don’t help, please ask.

        Jay
          Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
          • 10076
          • 1,024 Posts
          Hi,

          I applied the clearfix:

          .clearfix:after {
              content: "."; 
              display: block; 
              height: 0; 
              clear: both; 
              visibility: hidden;
          }
          
          .clearfix {display: inline-block;}
          
          /* Hides from IE-mac \*/
          * html .clearfix {height: 1%;}
          .clearfix {display: block;}
          /* End hide from IE-mac */


          And that works fine. Got rid of the "display: table;",used that because the margin: auto property did not function in IE7. However getting rid of the display table did not change anything and al seems well without it. Getting an error on the ".clearfix {display: block;}", but heck thats okay.

          Thanks frank.
            • 27708 MODX Staff
            • 2,502 Posts
            Quote from: Frank at Jan 21, 2008, 02:19 AM

            Getting an error on the ".clearfix {display: block;}", but heck thats okay.

            Thanks frank.

            What error are you receiving on the ".clearfix {display: block;}" the W3C validator is showing an error on the following ".clearfix {display:inline-block;}"?

            Well guess what? The validator is wrong...well sort of. Go back to the validator and run the check with more options and use CSS 2.1 and your CSS will validate.

            Your page is just fine.
              Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
              • 10076
              • 1,024 Posts
              as you said it validates fine, strano?

              thanks, fr