tags:

views:

54

answers:

2

I have a box center, and I want to color that box differently depend on the page. I try this

#center {
    margin-top: 2px;
    padding: 10px 20px;    /* CC padding */
    width: 100%;
    height: 800px;
    color: black;
    font-size: 11px;        
}
#backgroundRed{
    background-color: red;
}
#container {
    padding-left: 200px;   /* LC fullwidth */
    padding-right: 240px;  /* RC fullwidth + CC padding */
}
#container .column {
    position: relative;
    float: left;
}

so then I would try this

    <div id="containder">
        <div id="backgroundRed">
            <div id="center" class="column">
            abc   
            </div>
        </div>
    </div>

however the background of the box does not turn to red, someone explain to me what did I do wrong? btw, I must have class="column"

+4  A: 

Maybe what you wanted was this rule?

#backgroundRed div#center {
    background-color: red;
}

That means "if div#center is a child of #backgroundRed..."

Your example should make the outer div have a red background.

Nathan Long
Thank you, this fix my problem. Thank you very much.
Harry Pham
+1  A: 

Try the following code

#backgroundRed{
background-color:red;
overflow:hidden;
}
Eswar
It works to some degree with me. However, I think `overflow:hidden`, hide every thing else around it. I end up with a box, correctly color but everything around it disappear. +1
Harry Pham