/    Sign up×
Community /Pin to ProfileBookmark

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>

[/code]

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}
[/code]

to post a comment
CSS

1 Comments(s)

Copy linkTweet thisAlerts:
@LeeUDec 05.2008 — 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;
}
[/CODE]


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.
×

Success!

Help @javascriptlover spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...