Matthew905
Matthew905

Reputation: 1601

Css & Html, Whats the css for a div id inside div id

Trying to put a div id inside another div id, but having problems. The html is simple enough, a div inside a div with two closing divs beside each other, but I can't for the life of me get the css correct. I feel really silly asking such a newbie question, please help. I want the css to display the html with the outer container with a background color that shows around the outside of the inner container.

Can you give me an example of the css required for this? Thanks for your help, -Matthew

Upvotes: 2

Views: 4270

Answers (2)

oezi
oezi

Reputation: 51797

if your html looks like this (this is how i understood your description):

<div id="outer">
  <div id="inner">
    some content here
  </div>
</div>

your css should look like this:

#outer{
  background-color: red;
  padding: 5px;
}
#inner{
  background-color: blue;
}

Upvotes: 1

Michał Kuliński
Michał Kuliński

Reputation: 1976

Here you have example on JSFiddle:

http://jsfiddle.net/JXUeF/1/

Upvotes: 1

Related Questions