Reputation: 4187
<ul class="random-list">
<li>
<div class="random-container">
<div class="inline-block" style="vertical-align: top;">
<img src="" />
</div>
<div class="inline-block" style="vertical-align: top;">
<a href="">Name</a>
</div>
</div>
</li>
</ul>
And css:
.random-container {
margin-bottom: 10px;
width: 100%;
}
.inline-block {
display: inline-block;
}
Result:
How to fix this error:
Upvotes: 0
Views: 113
Reputation: 9544
<ul class="random-list">
<li>
<img src=""/>
<a href="">Name</a>
</li>
</ul>
#random-list
{
float:left;
}
Upvotes: 0
Reputation: 32202
Hey now according your design
you give to li properties display:block;
as like this
li{
display:block;
}
or this
.random-list li{
display:block;
}
Live demo http://jsfiddle.net/GrZLW/
Upvotes: -1
Reputation: 2165
Do you have enough space on your screen? Your code works for me as it works in this fiddle:
That said: another +1 goes to Truth's answer. Theres no need to use so many div
s you're currently using.
Upvotes: 1
Reputation: 175098
How about you don't use inline-block
at all, and get rid of all of those unnecessary divs.
<ul class="random-list">
<li>
<img src="" />
<a href="">Name</a>
</li>
</ul>
Upvotes: 6