如何使div元素显示为内联? [英] How do you make div elements display inline?
本文介绍了如何使div元素显示为内联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给定此HTML:
< div> foo< / div>< div> bar< / div>< ; div> baz< / div>
如何使它们以如下方式显示:
foo bar baz
不是这样:
foo
栏
baz
< style type =text / css>
div.inline {float:left; }
.clearBoth {clear:both; }
< / style>
< 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/><! - 你可能需要也可能不需要 - >
Given this HTML:
<div>foo</div><div>bar</div><div>baz</div>
How do you make them display inline like this:
foo bar baz
not like this:
foo
bar
baz
解决方案
That's something else then:
<style type="text/css">
div.inline { float:left; }
.clearBoth { clear:both; }
</style>
<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 -->
这篇关于如何使div元素显示为内联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文