cola
cola

Reputation: 12476

How can I combine multiple CSS rules?

div#id_div_allposts {   
    width: 100%;    
}

div.class_div_post {
    width: 100%;
}

div.class_div_editdelete {
    width: 100%;
}

How can i write it in one line ?

And what's the way to select a html tag with id and class ?

Upvotes: 3

Views: 4770

Answers (4)

Ryan Potter
Ryan Potter

Reputation: 845

All you have to do is separate them with a comma e.g

div#id_div_allposts,
div.class_div_post,
div.class_div_editdelete {
    width:100%;
}

Upvotes: 7

Harry Joy
Harry Joy

Reputation: 59694

Try this:

div#id_div_allposts, div.class_div_post, div.class_div_editdelete {
    width: 100%;
}

or assuming that you want all div to have width 100% then...

div{
    width: 100%;
}

Upvotes: 0

Doozer Blake
Doozer Blake

Reputation: 7797

Use the comma to separate multiple declarations

div#id_div_allposts, div.class_div_post, div.class_div_editdelete {
    width: 100%;
}

Selecting an html tag with and id and class would be

div#ID.class

Upvotes: 0

Russell Dias
Russell Dias

Reputation: 73382

div#id_div_allposts, div.class_div_post, div.class_div_editdelete {
    width: 100%;
}

You can group multiple selectors in CSS via a comma.

Note: The comma starts an entirely new selector from the very start.

Upvotes: 0

Related Questions