我有一个项目列表,其中包含<div>
。CSS - 调整列表标题的格式
#list-container:before {
content: 'My list:';
}
#list-container span {
display: block;
}
<div id="list-container">
<span>item1</span>
<span>item2</span>
<span>item3</span>
<span>item4</span>
<span>item5</span>
<span>item6</span>
</div>
我想设置的标题(“我的目录”)的项目清单是在同一行中的第一项(“物品1”),但我不要改变项目的左对齐(我希望它看起来好像是这样):
My list: item1
item2
item3
etc.
不这样的:
My list: item1
item2
item3
etc.
我当前正在使用:before
来放置“我的列表:”,但它将它放在“项目1”的上方(请参阅上面的代码段)。
有没有人知道一种方法来获取列表项的标题与第一个项目在同一行上,而不是将第一个列表项目推到一边?
谢谢。
你检查了答案吗?请投票/接受其中一个,或更新您没有得到您想要的答案。 – Dekel