在单行中显示标题和内容



我想在一行中显示标题及其内容,但它分成两行。

例如:

<h3> Some Heading: </h3>
<p> Some Content </p>

在此,我想像这样显示它:

Some Heading: Some Content

如果有人可以帮助解决这个问题,将不胜感激。

将其添加到您的 css 代码中。

h3,p {
  display:inline-block;
}

已经由@Dogukan Cavus回答了。

标题和内容可以通过添加 display: 内联块到 css 样式以单行显示。

<h3 style="display: inline-block"> Some Heading: </h3>
<p style="display: inline-block"> Some Content </p>

示例:http://jsfiddle.net/a4aME/1/

两个标签都换成div,并将div显示属性设置为 flex

<div style="display: flex">
   <h3> Some Heading: </h3>
   <p> Some Content </p>
</div>

最新更新