簡體   English   中英

如何將圖像放置在無序列表的右側?

[英]How do I position an image just to the right of an unordered list?

好吧,也許會有一點偏移,但是如果我使用align="right"那么它將一直指向頁面的右邊。 我想要類似的東西

- List item one                  ---------
 - List item two                  | image |
 - List item three                |       |
 - List item with a longer text   ---------

嘗試這個...

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" />

預覽這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM