user2939345 user2939345 - 6 months ago 15
HTML Question

Floating divs in list (Google Chrome)

I need two divs to be next to eachother in a list. The following code works fine in Firefox, but not in Google Chrome:

<ul>
<li>
<div style="float:left;">DIV 1</div>
<div>DIV 2</div>
</li>
</ul>


See the bullet position in Google Chrome:

Bullet position in Google Chomre

What am I doing wrong?

Answer

Rather than using float:left; use display:inline-block; on both div's. That will allow them to be in the same line. Here's an updated Fiddle showing that: https://jsfiddle.net/1odd1ju6/1/

Comments