gpt4 book ai didi

html - 如何将段落环绕在图像周围?

转载 作者:太空宇宙 更新时间:2023-11-03 23:23:51 25 4
gpt4 key购买 nike

我无法在图像周围环绕文字。段落不围绕图像。我试过 float ,但仍然无法正常工作!

这是html代码:

<div class="article">
<h3>This is the title</h3>
<hr>
<img src="imgtest.jpg"></img>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
<div class="clear"></div>
</div>

这是CSS代码

.article{
padding: 10px;
border: 1px solid white;
background: #FAFAF8;
box-shadow: 0.5px 0.5px 4px black;
margin-bottom: 20px;
border-radius: 5px;
width:600px;
}

.article p{
float: left;
width: 550px;
}

.article img{
float: right;
overflow: auto;
}

.article h3{
padding: 10px;
font-size: 26px;
padding: 3px;
margin:0px;
}

最佳答案

.article p 中删除 float:left; 应该可以解决您的问题。

关于html - 如何将段落环绕在图像周围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27785227/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com