p
内的文字应与h3
元素位于同一行,就像下图中的文字一样,但不使用margin
或padding
。对此有何解决方案?
.inner h1, h3{
display: inline-block;
vertical-align: text-bottom;
}
<div class="inner">
<h1>1.</h1> <h3>Download app</h3> <h3>Free</h3>
<p> Some text here Some text here Some text here</p>
<p> Some text here Some text here Some text here</p>
</div>
答案 0 :(得分:2)
您可以简单地使用ol
列表:
<ol>
<li>
<h3>Download app<br/>Free</h3>
<p> Some text here Some text here Some text here<br/>Some text here Some text here Some text here</p>
</li>
</ol>
答案 1 :(得分:0)
将text-indent
提供给p
标记,如下所示:
.inner p {
text-indent: 23px;
}
.inner h1, h3{
display: inline-block;
vertical-align: middle;
}
.inner p {
text-indent: 23px;
}
<div class="inner">
<h1>1.</h1><h3> Download app</h3> <h3>Free</h3>
<p> Some text here Some text here Some text here</p>
<p> Some text here Some text here Some text here</p>
</div>
答案 2 :(得分:0)
使用flex-box
,您可以&#34;伸展&#34; h1
占据右侧的整个高度。
.inner {
display: flex;
}
h1,
h3 {
margin: 0;
}
&#13;
<div class="inner">
<h1>1.</h1>
<div>
<h3>Download app Free</h3>
<p> Some text here Some text here Some text here</p>
<p> Some text here Some text here Some text here</p>
</div>
</div>
&#13;