www.webdeveloper.com
Results 1 to 2 of 2

Thread: Container div woe

  1. #1
    Join Date
    Nov 2008
    Posts
    39

    Container div woe

    Hi,

    I've placed a "container" div inside the entire body, encompassing all html elements. Despite this, I can't its background colour to apply to all those elements. Anybody know how I'm causing only part of the html to be effected?

    Thanks


    Code:
    <body>
      <div id="container">
    
    	<div id="image">
        <img src="labradoodle.gif" alt="labradoodle">
      </div>
    
      <div id="introduction">
    		<h1>The Labradoodle</h1>
        <h2> Labradoodles are popular household pets, offspring of a poodle/labrador cross. </h2></div>
      </div>
    
      <div id="info">
        <p>They are beloved in Japan especially, and have taken on popularity in the west since Orlando Bloom famously was seen purchasing one in a downtown Hollywood pet boutique.</p>
      </div>
      
      </div>
    </body>
    and the CSS:

    Code:
    body {
    margin:50px 0px 50px 0px}
    
    	
    #container {
    	width:700px;
    	margin: auto;
    	padding:10px;
    	background-color:#7FFFD4;
    	}
    
    
    #image{float:left; margin: 10px 20px 10px 10px}}
    #introduction{padding: 30px 30px}
    #information{width:600px; margin:auto}

  2. #2
    Join Date
    May 2004
    Location
    FL
    Posts
    3,447
    Use this:
    Code:
    body {
      margin:50px 0;
      color: #000; /* you should always specify the color when you specify the background-color, and vice-versa  */
      background-color:#7FFFD4;
    }
    
    	
    #container {
    	width:700px;
    	margin: auto;
    	padding:10px;
    }
    BTW, you don't need to specify the unit of measurement for "0". Also, if the top and bottom margins are the same, and the right and left margins are the same, you can do them as above.
    Lee

    ""Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."" -- Sir Winston Churchill

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles