Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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%;
}

Solution 2:

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.


Solution 3:

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

Solution 4:

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%;
}

Post a Comment for "How Can I Combine Multiple CSS Rules?"