尝试获得一个结果,该结果将概述井.outline类,但它的间距太小,当我尝试在.intro类中使用以下代码时。
.intro {
/** Text Formatting **/
text-align: center;
/** Line Spacing **/
line-height: 3em;
}
如果我没有使用行高,我得到的结果仍然与我的结果相同。
HTML
<div class="intro"> <h4> In my <span class="outline">corner</span> of the internet I make messes that some how turn into code. Don't ask me <span class="outline">how</span>, don't ask me <span class="outline">corner</span>, but things just look good and work well.</h4> </div>
CSS
.outline {
/** Styling **/
background: #ff00f6;
color: #FFF;
/** Margin & Padding **/
margin: 3px;
padding: 6px 8px;
}
答案 0 :(得分:1)
您提到的代码似乎工作正常。我可以看到一个问题,可能是您的CSS与line-height
发生冲突。尝试将!important
与css放在一起,如下所述:
.intro {
/** Text Formatting **/
text-align: center;
/** Line Spacing **/
line-height: 3em !important;
}
的 Demo 强>