繁体   English   中英

如何在图像周围换行?

[英]how to wrap a text around a image?

我有一张我想要一些文字会环绕的图像。 通过提供负的上限值并将其位置设为相对位置,我将图像放置得更高一些。 但是它在图像下方显示了一些空白。 我想用文本删除空白。 我怎样才能做到这一点?

这是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> 

试试这个

.what_text_container > img {
  border-radius: 15px;
  float: right;
  margin-top: -150px;
}

删除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;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM