Rhyso
Rhyso

Reputation: 696

Less first-child

Why isn't my first-child selector working in Less?

.leftPanel{
    margin:20px;
    float:left;
    display:inline;
    width:620px;
    margin-left:10px;
    select{
        width:300px;    
        &:first-child{
            margin-right: 30px;             
        }
    }
}

Upvotes: 18

Views: 48931

Answers (1)

Kaivosukeltaja
Kaivosukeltaja

Reputation: 15735

You are specifying that if the first child element inside a .leftPanel is a <select>, it should have margin-right: 30px;. If you are trying to apply this rule to the first child element inside the <select> (which should always be an <option>), try replacing &:first-child with option:first-child.

Upvotes: 18

Related Questions