我有一个为我的 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/