如何将这些单词与 CSS 放在同一行中?

  • 本文关键字:一行 单词 CSS html css
  • 更新时间 :
  • 英文 :


我想把这些词放在同一行上。我尝试了所有display选项,也尝试了text-align.什么都没用。

片段

<h3 id="trying">
If you have time, you should read more about this incredible human being on his 
<a href="https://en.wikipedia.org/wiki/Norman_Borlaug" target="_blank">
Wikipedia Entry
</a>.
</h3>

一种简单的方法是增加 h3 标签的宽度,因为 h3 标签是块类型元素

h3{
width:900px;
}
<h3 id="trying">If you have time, you should read more about this incredible human being on his <a href="https://en.wikipedia.org/wiki/Norman_Borlaug" target="_blank">Wikipedia Entry</a>.</h3>

您应该注意容器的width,这可能是原因。

#trying{
width:100%
}

它将与父容器相同。