如何对齐段落旁边的图像

时间:2012-09-17 21:01:38

标签: html css

像这样......

[img here] [段落]

而不是我现在拥有的。

[img here]

[这里的段落]

HTML

   <p> <div class="polaroid">
     <img src="Me1.jpeg" title="Me" alt="Me" align="left" />
    <p class="polo">That's Me!!!</p>
       </div></p>
    </div>

    <div class="blocker03">
    <p class="description">
 blah blah blah blahblah blahblah blahblah blahblah blahblah blahblah blahblah blah
  blah blahblah blahblah blahblah blahblah blahblah blahblah blahblah blahblah blah
    blah   blahblah blahblah blahblah blahblah blah</p>
    </div>

CSS

.blocker03 {
 width:470px;
 padding-left:60px;
 margin:0 0 10px 25px;
 font-size:12px;
 display:inline-block;
  }

.polaroid {
postion: relative;
float: right;
border: 3px solid #C6930A;
border-style:dotted;
background: #66594C;
width: 140px;
padding: 5px;
margin: 5px;
text-align: center; 
-moz-box-shadow: 1px 1px 3px #222;
-moz-transform: rotate(-5deg);
-webkit-box-shadow: 1px 1px 3px #222;
-webkit-transform: rotate(-5deg);
box-shadow: 1px 1px 3px #222;
-o-transform: rotate(-5deg);
transform: rotate(-5deg);
    } 

4 个答案:

答案 0 :(得分:9)

所以那里有一些草率的代码,但请查看这个jsfiddle以获取使用float的示例:

http://jsfiddle.net/tH2qc/

这里有一些基于你的代码的东西:

http://jsfiddle.net/zZkpw/

答案 1 :(得分:4)

如果这样可以正常工作,那么这一切都有点过分:

<p><img src="*[your image]" align="right" valign="middle" vspace="5" hspace="5"/>[your text]</p>

答案 2 :(得分:0)

试试这个

<div style="float:left;width:800px" id="container">
    <div id="rightContainer" style="float:left;width:100px;">
        <img src="Me1.jpeg" title="Me" alt="Me" align="left" />
        <p class="polo">That's Me!!!</p>
    </div>
    <div id="leftContainer" style="float:right;width:600px;">
        <p class="description"> blah blah blah blahblah blahblah blahblah</p>
    </div>
</div>

答案 3 :(得分:0)

这个会起作用:

.polaroid img, .polaroid p{
   float:left;
   display:inline;
}