坚持用css定位图像

时间:2015-04-01 13:51:10

标签: html css position css-position

我正在创建一个网站,我需要包含一个关于女演员梅丽尔斯特里普的页面。我试图在她的奖项旁边摆出她的形象。下图显示了我的页面现在的样子。我想知道如何制作它以使图片与文本右侧而不是下方对齐?感谢。

enter image description here

这是html代码:

 <div class="info">
<a id="awards"><h2>Awards: </h2></a>
<h3>Academy Awards</h3>
<h4>Won</h4>
<ol>
<li>Best Supporting Actress (Kramer vs. Kramer) - 1979</li>
<li>Best Actress (Sophie's Choice) - 1982</li>
<li>Best Actress (The Iron Lady) - 2011</li>
</ol>
<h4>Nominated</h4>
<ol>
<li>Best Supporting Actress (The Deer Hunter) - 1978</li>
<li>Best Actress (The French Lieutenant's Woman) - 1981</li>
<li>Best Actress (Silkwood) - 1983</li>
<li>Best Actress (Out of Africa) - 1985</li>
<li>Best Actress (Ironweed) - 1987</li>
<li>Best Actress (A Cry in the Dark) - 1988</li>
<li>Best Actress (Postcards from the Edge) - 1990</li>
<li>Best Actress (The Bridges of Madison County) 1995</li>
<li>Best Actress (One True Thing) - 1998</li>
<li>Best Actress (Music of the Heart) - 1999</li>
 <li>Best Supporting Actress (Adaption) - 2002</li>
 <li>Best Actress (The Devil Wears Prada) - 2006</li>
 <li>Best Actress (Doubt) - 2008</li>
 <li>Best Actress (Julie & Julia) - 2009</li>
 <li>Best Actress (August: Osage County) - 2013</li>
 <li>Best Supporting Actress (Into the Woods) - 2014</li>
</ol>
 <div class="oscar">
 <img src="oscar.jpg" alt="Picture of Meryl with an oscar" width="300" 
 height="400"/></a>
</div>
</div>

div的div:info:     .info {         背景颜色:白色;         边界:凹槽;         border-top-right-radius:3em;

3 个答案:

答案 0 :(得分:0)

你尝试过用过桌子吗?

<table>
<tr><td>1.Best Actor</td>
<td><img src="image.jpg"></td>
</tr>

依旧......

它可能会帮助你:)

答案 1 :(得分:0)

您可以使用浮动属性来浮动它 http://rao5s.vn/29-0-ipad-air-3g-va-ipad-3-3g-mau-trang-gia-tot.html

<div style="float: left;">
  1. Best Actress
  2. Best Actress
  3. Best Actress
  4. Best Actress
</div>
<div style="float: right;">
  <img src="link-to-image-file" />
</div>

答案 2 :(得分:0)

你必须加入第二个&#34; ol&#34;风格:

宽度:自动; float:left;

然后它有效。