我有一个图像,我想要一些文字将环绕。我通过给出负顶值并使其位置相对来将图像放置得更高一些。但它在图像下显示了一些空白区域。我想用文本删除空白区域。我怎样才能做到这一点?
这是html代码
.what_text_container>p {}
.what_text_container>p>span {
font-style: italic
}
.what_text_container>img {
border-radius: 15px;
float: right;
position: relative;
top: -150px;
}
<div class="what_text_container">
<img src="assets/images/carolina.png" width="324" height="215" alt="" />
<p>
<span>"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful.</span>
<br> "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder
of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves
or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical
exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"<br>
<br> "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder
of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves
or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example,<br>
<br> "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder
of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves
or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical
exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
</p>
</div>
答案 0 :(得分:0)
试一试
.what_text_container > img {
border-radius: 15px;
float: right;
margin-top: -150px;
}
答案 1 :(得分:0)
删除top属性。
保持你的CSS这样。
.what_text_container > p {
}
.what_text_container > p > span {
font-style:italic
}
.what_text_container > img {
border-radius: 15px;
float: right;
position: relative;
}
或删除职位:
.what_text_container > p {
}
.what_text_container > p > span {
font-style:italic
}
.what_text_container > img {
border-radius: 15px;
float: right;
margin-top: -150px;
}