开发者

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 wha开发者_如何学Ct's the way to select a html tag with id and class ?


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


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.


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


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜