Reputation: 465
For simplicity, I'm using inline styles so you can see what's going on. I've used a red border for list elements and a black border for the images? Why aren't the images aligned properly? This has been driving me nuts.
See screenshot:
See code:
<ul>
<li style="border: 1px solid red">Result <span style="display: block; float: right; border: 1px solid #000"><img src="../../resources/images/delete.png" /></span></li>
<li style="border: 1px solid red">Result <span style="display: block; float: right; border: 1px solid #000"><img src="../../resources/images/delete.png" /></span></li>
<li style="border: 1px solid red">Result <span style="display: block; float: right; border: 1px solid #000"><img src="../../resources/images/delete.png" /></span></li>
</ul>
JS Fiddle
Upvotes: 2
Views: 795
Reputation: 157284
You need to clear the floats
<ul>
<li style="border: 1px solid red">Result
<span style="display: block; float: right; border: 1px solid #000">
<img src="../../resources/images/delete.png" />
</span>
<div style="clear: both;"></div>
</li>
<!--Same for other li-->
</ul>
But this is a dirty way, I would've used background-image
and background-position
for <li>
element instead(Unless and until you'll be using image as a link or for some click purpose)
Upvotes: 4