我有一个为WordPress主题首页创建的静态页面,现在我想添加一个自定义博客。我希望博客有所不同,并具有不同的标题,段落属性等。我能否仅添加一个额外的名称来区分首页类和博客类,以便可以使用它们?

例如:

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p {
border:0;
font-size:100%;
font:inherit;
vertical-align:baseline;
margin:0;
padding:0;
}


看起来像这样:

blog html,blog body,blog div,blog span,blog applet,blog object,blog iframe,blog h1,blog h2,blog h3,blog h4,blog h5,blog h6,blog p {
border:0;
font-size:100%;
font:inherit;
vertical-align:baseline;
margin:0;
padding:0;
}


比称呼它时,我会这样做吗?

<blog h1>This is heading 1</blog h1>


还是在这种情况下需要像普通班级那样称呼它?因此:

<div class="blog h1">This is a test</div>

最佳答案

最好的方法之一是使用Blog作为ID,然后定义您的类:

#blog .h1{
border:0;
font-size:100%;
font:inherit;
vertical-align:baseline;
margin:0;
padding:0;
}

<div id="blog" class="h1">This is a test</div>

关于html - 具有多个基本CSS类的变体(即h1,h2,p),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20171726/

10-11 14:58
查看更多