我们如何在<p>
我试过的段落的右侧显示图像,但它始终位于<p>
小提琴http://jsfiddle.net/ECEka/44/
<div class="service-list">
<p>text goes here text goes heretext goes heretext goes heretext goes heretext goes here
text goes here text goes heretext goes heretext goes heretext goes heretext goes here</p>
<p>text goes here text goes heretext goes heretext goes heretext goes heretext goes here
text goes here text goes heretext goes heretext goes heretext goes heretext goes here</p>
<img src="https://www.google.co.in/images/srpr/logo4w.png" alt="icon" width="200" height="auto" />
</div>
答案 0 :(得分:4)
答案 1 :(得分:0)
您必须将图像放在p
标记内(位于顶部),然后将其向右浮动。
<强> HTML 强>
<div class="service-list">
<p>text goes here text goes heretext goes heretext goes heretext goes heretext goes here
text goes here text goes heretext goes heretext goes heretext goes heretext goes here</p>
<p>
<img src="https://www.google.co.in/images/srpr/logo4w.png" alt="icon" width="200" height="auto" />text goes here text goes heretext goes heretext goes heretext goes heretext goes here
text goes here text goes heretext goes heretext goes heretext goes heretext goes here</p>
</div>
<强> CSS 强>
.service-list {
width: 600px;
margin-left:0px;
padding-left:0px;
display: block;
background-color:yellow;
}
.service-list p img {
float:right;
}
.service-list p {
text-align: left;
display:block;
padding: 0;
}