首页 > 解决方案 > 试图在同一行上有一个标题和无序列表项

问题描述

我看了又看,尝试了不同的 CSS 变体,但到目前为止没有成功。

不确定这是否可能,但尝试在无序列表项中包含 H4 和内容。

我可以将 H4 添加到列表项中,但在标题之后,内容继续从下一行开始,如“我不断获取示例的问题模型”中所示。我试图将内容与 H4 保持在同一行,如果字符太多,则文本可以转到下一行。

代码示例

<ul>
<li><h4>H4 Headline</h4> - This is the text that will start on the same line as the headline. This is the text that will start on the same line as the headline. This is the text that will start on the same line as the headline.</li>
<li><h4>H4 Headline</h4> - This is the text that will start on the same line as the headline. This is the text that will start on the same line as the headline. This is the text that will start on the same line as the headline.</li>
<li><h4>H4 Headline</h4> - This is the text that will start on the same line as the headline. This is the text that will start on the same line as the headline. This is the text that will start on the same line as the headline.</li>
</ul>

我需要的样机示例

在此处输入图像描述

我不断得到示例的问题模型 在此处输入图像描述

关于如何实现这一目标的任何建议?

标签: htmlcsshtml-lists

解决方案


您需要做的就是在 CSS 部分中使用以下内容

h4{
   display: inline;
}

推荐阅读