Tom*_*lak 10
h2, p {
display: inline;
}
div.p {
/* whatever margins/paddings you would normally apply to p */
}
Run Code Online (Sandbox Code Playgroud)
和
<div class="p">
<h2>This is the heading.</h2>
<p>This is the paragraph</p>
</div>
Run Code Online (Sandbox Code Playgroud)
您需要将所有内容括<p>
在块级元素(如<div>
)中,以避免连续的段落崩溃.
你自己几乎回答了这个问题;)
h1, p {
display: inline;
}
Run Code Online (Sandbox Code Playgroud)
不确定它是否适用于IE6(我在inline-block
这里感到困惑,inline
在所有浏览器中都能正常工作)