How to make two divs appear on the same line? (Not using table table, table is not very friendly to SE) In fact, <div> is a block-level element, that is to say, browsers usually place a line break before and after the div element. You can add an attribute float:left, the demo code is as follows
1
2
3
4
|
<div style="width=2000px">
<div style=
"float:left; width:100px; border:2px solid #aa00FF; "
>第一个div</div>
<div style=
"float:left; width:100px; border:2px solid #0033FF; "
>第二个div</div>
</div>
|