小编典典

如何使div元素内联显示?

html

鉴于此HTML:

<div>foo</div><div>bar</div><div>baz</div>

如何使它们像这样内联显示:

foo bar baz

不像这样:

foo
bar
baz


阅读 280

收藏
2020-05-10

共1个答案

小编典典

那是另一回事:

div.inline { float:left; }

.clearBoth { clear:both; }


<div class="inline">1<br />2<br />3</div>

<div class="inline">1<br />2<br />3</div>

<div class="inline">1<br />2<br />3</div>

<br class="clearBoth" /><!-- you may or may not need this -->
2020-05-10