如何在文本后结束虚线边框而不是在正确的方向上跨页面延伸?

时间:2016-10-09 08:01:05

标签: html css border

Dashed border (screenshot and preferred ending point)

正如您所看到的,边框延伸到页面的末尾,当我在文本结束后立即结束时(几乎)。有没有具体的方法来做到这一点? 附:我希望它只是这种方式用于这个标题,而不是其他任何东西。

这是我的代码:



<h1 style="border-style:dashed;border-left-width:2px;border-right-width:2px;border-width:2px;border-color:black;"><b><u>Current Projects (in order of importance):</b></u></h1>
<p><ol>
	<li>Apartment Life Redux</li>
	<li>Sharpshooter Infinite</li>
</ol></p>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

我创建了一个代码片段,可以帮助您解决问题。

我添加了display: inline-block,然后在您的文字后面结束。

像这样:

.dashed-border {
  border-style:dashed;
  border-left-width:2px;
  border-right-width:2px;
  border-width:2px;
  border-color:black;
  display:inline;
}
<h1 class="dashed-border"><b><u>Current Projects (in order of importance):</b></u></h1>
<p><ol>
	<li>Apartment Life Redux</li>
	<li>Sharpshooter Infinite</li>
</ol></p>

答案 1 :(得分:0)

你只需要添加code --disable-extensions,剩下的就可以了。

&#13;
&#13;
display:inline;
&#13;
&#13;
&#13;

如果您只想为特定元素设置属性,可以使用元素ID,如。

<h1 style="border-style:dashed;border-left-width:2px;border-right-width:2px;border-width:2px;border-color:black; display:inline;"><b><u>Current Projects (in order of importance):</b></u></h1>
<p><ol>
	<li>Apartment Life Redux</li>
	<li>Sharpshooter Infinite</li>
</ol></p>

希望它有用