Reputation: 51064
I have the following ul type list, and need to get it to display horizontally, but it doesn't. What am I missing?
<ul style="display: inline;">
<li>
<div class="store-display-item" style="display: inline;">
<img class="store-display-image" src="/Images/ToughBook.jpg">
</div>
</li>
<li>
<div class="store-display-item" style="display: inline-block;">
<img class="store-display-image" src="/Images/ToughBook.jpg">
</div>
</li>
</ul>
Upvotes: 0
Views: 124
Reputation: 47667
Make your <li>
-s inline - DEMO
<ul>
<li style="display: inline;">
<div class="store-display-item" style="display: inline;">
<img class="store-display-image" src="/Images/ToughBook.jpg">
</div>
</li>
<li style="display: inline;">
<div class="store-display-item" style="display: inline-block;">
<img class="store-display-image" src="/Images/ToughBook.jpg">
</div>
</li>
</ul>
Two things to make your code cleaner:
<div>
inside the <li>
looks unnecessary - you can style the <li>
to behave like a containerEXAMPLE
<style>
li { display: inline; }
</style>
<ul>
<li><img class="store-display-image" src="/Images/ToughBook.jpg"></li>
<li><img class="store-display-image" src="/Images/ToughBook.jpg"></li>
</ul>
Upvotes: 3
Reputation: 13800
You can use display: inline-block;
.
ul {font-size: 0;}
li {display: inline-block; vertical-align: top; *display: block; zoom: 1;}
Don't listen to people who say that display: inline-block;
doesn't work in IE7. It does if you know what you're doing.
Upvotes: 0
Reputation: 5720
li {
float: left
}
need to float your li.
or you can use display: inline-block;
on your li doesn't work in IE7 and older
li {
display: inline-block;
}
Upvotes: 2