teepusink
teepusink

Reputation: 28892

CSS selected using double nested class not selecting the right element

I'm trying to select the div that has "Trying to access this element"

<div id="main" class="wrapper clearfix 3-column">
   <div id="col1" class="floatleft">
      <div><img src="img/main.jpg" /></div>
      <div class="col1-grid2">
         Trying to access this element
      </div>
    </div>
</div>

Doing .col1-grid2 or #main .col1-grid2 works as expected. However, why would doing .3-column .col1-grid2 not target the element?

Upvotes: 0

Views: 271

Answers (1)

Rajesh J Advani
Rajesh J Advani

Reputation: 5710

The problem is not the selector, it's the name of the class. 3-column is not a valid class name. It must start with a -, _ or a letter (a-z or A-Z). EDIT: updated to say not just lower case letters

Upvotes: 2

Related Questions