是否可以使列表内的块元素不落入下一行?
li{
list-style-type:decimal;
list-style-position:inside;
}
div{
display:table-cell;
}
/*make P element display:inline is not what I want*/
<li><p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p></li>
<h3>The following is what I want:</h3>
<div>1. </div><div>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</div>
最佳答案
如果要使列表样式指示符和p元素并排,请摆脱:
list-style-position:inside;
您可能需要调整父元素的填充/边距,但这将允许您要查找的并排布局。
关于html - 使列表内的块元素不属于下一行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43218754/