How do I position an image just to the right of an unordered list?
Well, maybe with a little offset, but if I use align="right"
then it goes all the way to the right of the page. I'd like something like
- 开发者_C百科List item one --------- - List item two | image | - List item three | | - List item with a longer text ---------
Try this...
ul {
float:left;
width:(width you choose);
}
img {
float:left;
margin-left:5px(or however far away you want it);
width:(width);
height:(height);
}
<style>
#list {
float: left;
}
#list_image {
float: left;
margin-left: 40px;
}
</style>
<ul id="list">
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<li>List item with a longer text</li>
</ul>
<img src="http://www.google.com/images/logos/ps_logo2.png" id="list_image" />
Preview: here
精彩评论