Reputation: 3
I struggled for this issue for hours, but can't get it work still.
I have the html code like this :
<ul>
<li><div>aa</div><div>aa11</div><li>
<li><div>bb</div><div>bb11</div><li>
</ul>
I wondered how to use css to let the <div>
display in one line each li. But the <ul><li>
label still have its vertical style.
I am new to CSS, and any help will be thankful.
Upvotes: 0
Views: 68
Reputation: 378
I have Updated your code, Here is the JSFiddle link and let me know if you want more change:
HTML:
<ul>
<li><div>aa</div><div>aaa1</div></li>
<li><div>bb</div><div>bbb1</div></li>
</ul>
CSS:
ul li{
float: left;
}
Upvotes: 0
Reputation: 4360
ul li{
display: table;
}
ul li div{
float: left;
}
This will make the <div>
inside the <li>
to look side by side.
Upvotes: 2
Reputation: 328
<li style="float:left"><div>aa</div><div>aa11</div></li>
and end your list items with
</li>
not with <li>
Upvotes: 0
Reputation: 787
It looks like you forgot to close your <li>
tags, you have opening <li>
tags but you didn't close them with </li>
. If you want to make aa
and aa11
side-by-side you also need to add a display: inline-block;
style to your div
s. Here's a demonstration: http://jsfiddle.net/5wLku/
Here's my solution:
<ul>
<li><div>aa</div><div>aa11</div></li>
<li><div>bb</div><div>bb11</div></li>
</ul>
Upvotes: 0
Reputation: 97
You might also want to add
list-style-type: none;
in order to get rid of the bullet-points. In addition to what @Viswalinga Surya S said
Doing that, would give you this --> http://jsfiddle.net/A35Fe/
Upvotes: 0