how to apply the following css class

Discussion in 'CSS' started by tong123123, Apr 17, 2012.

  1. #1
    
    .class1 .class1_1{  
            div {background-color:#b0c4de;}     
        }  
    
    Code (markup):
    I try

    
        <div class="class1_1">div1</div>  
        <div class="class1">outerDiv  
            <div class="class1_1">innerDiv  
                <div>InnerMost Div</div>  
            </div>  
        </div>  
    
    Code (markup):

    but all fail.

    I have interested to know these because these type of css class is always seen in gwt project.
     
    tong123123, Apr 17, 2012 IP
  2. ademmeda

    ademmeda Active Member

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    3
    Trophy Points:
    70
    #2
    To style the innermost div, use the following:

    .class1 .class1_1 div {  
            background-color:#b0c4de;
    }
    Code (markup):
     
    ademmeda, Apr 18, 2012 IP
  3. runner

    runner Active Member

    Messages:
    251
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    
    .class1 .class1_1{  
            div {background-color:#b0c4de;}     
        }
    
    HTML:
    This is wrong....

    Try this, it tells that Look for div in the class1_1 which is under the class1
    
    .class1 .class1_1 div{  
            background-color:#b0c4de;
    }    
        
    
    HTML:
     
    runner, Apr 19, 2012 IP
  4. Devitor

    Devitor Peon

    Messages:
    57
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    0
    #4
    I know this is a bit irrelevant to your question, but if it is not necessary to format your divs like that you should just add another class name to the div you want to style. The CSS will be processed faster than if you nest three containers like how you are doing.

    I am not saying that your approach is wrong ( it is not wrong, I do it myself for certain cases) but if you are able to just add another class it will handle it much faster.

    Hope you find this helpful.
     
    Devitor, Apr 19, 2012 IP
  5. William Rauen

    William Rauen Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    plz visit here:-
     
    William Rauen, Apr 24, 2012 IP