首页 > 解决方案 > 是否可以在 CSS 中为线框添加边框?

问题描述

AFAIK,在外部,线框位于仅包含堆叠线框的块容器中。在内部,行框由一个或多个适合一行的行内级框组成。

为了更好地理解它们的关系,我想知道是否可以为行框添加边框,而不是块容器或每个单独的行内级框。

来自 CSS 权威指南 4ed 的示例:

在此处输入图像描述

代码示例(没有线框边框):

p > span {border: 1px solid black; display: inline-block;}
<p style="font-size: 25px; line-height: 25px;">
<span>This is text, <em>some of which is emphasized</em>, plus other text</span><br>
<span>which is <strong style="font-size: 50px; vertical-align: 10px;">strongly 
emphasized</strong> and which is</span><br>
<span>larger than the surrounding text.</span>
</p>

标签: css

解决方案


推荐阅读