这是一个顶级问题,更基于我对css的无知。我试图在css中创建两个段落样式,一个是20px字体大小,另一个是14px字体大小。不过,无论我看起来如何,字体都是一样的。附上的是我现在正在做的事情的一个例子,如果任何人都能指出我的解决方案,我将非常感谢。为了避免不必要的代码,我为了不少的原因而放弃了。在css中设置多个段落样式
html代码看起来像这样
<p>This is the html section with 20 px font</p>
<p class="new_font"> This is the html section with 8px font</p>
/* I have also tried this with a <div class="new_font"> and and <p id="new_font>"*/
的CSS代码如下所示
p {
/*text-indent: 1.5em;*/
font: 20px Helvetica, Sans-Serif;
color: white;
overflow: hidden;
padding: 15px;
text-align: justify;
background: rgb(0, 0, 0,0.3); /* fallback color */
background: rgba(0, 0, 0, 0.7);
}
p new_font {
/*text-indent: 1.5em;*/
font: 14px Helvetica, Sans-Serif;
color: white;
overflow: hidden;
padding: 15px;
text-align: justify;
background: rgb(0, 0, 0,0.3); /* fallback color */
background: rgba(0, 0, 0, 0.7);
}
p new_font'只要改变''到p.new_font' –
尝试是这样的https://jsfiddle.net/2Lzo9vfc/113/ –
或者干脆.new_font – progsource