gpt4 book ai didi

html - 不能在一行图像后强制换行

转载 作者:搜寻专家 更新时间:2023-10-31 22:48:31 26 4
gpt4 key购买 nike

在一篇博文中(对于 Cooking Stackexchange blog,这是一个只有几个插件的普通 WordPress 实例),我插入了三张图像,向“左”对齐,并希望它们占据自己的行。我希望文本从它们下面开始。

无论我尝试什么,(我手动插入了您在代码中看到的 <p><br><div> 标签)文本与图像在同一行开始,看起来很糟糕。我能做些什么?

The wrong layout

生成上面截图的代码:

<p> I expected a bigger difference between these 3 methods. The silicone mat browned the cookies a bit
less than the other methods – so it can provide a little insurance if
you’re afraid of burnt cookies. </p>
<div><img class="wp-image-870 alignleft" style="margin-left: 2px; margin-right: 2px;" title="baking sheet cookies" src="http://cooking.blogoverflow.com/files/2012/08/IMG_3784-225x300.jpg" alt="Cookies baked on baking sheet" width="225" height="300" /><img class="wp-image-869 alignleft" style="margin-left: 2px; margin-right: 2px;" title="silpat cookies" src="http://cooking.blogoverflow.com/files/2012/08/IMG_3787-225x300.jpg" alt="" width="225" height="300" /><img class="alignleft size-medium wp-image-868" style="margin-left: 2px; margin-right: 2px;" title="parchment paper cookies" src="http://cooking.blogoverflow.com/files/2012/08/IMG_3790-225x300.jpg" alt="" width="225" height="300" /><br/></div>
&nbsp;
<p>I’m going to stick with parchment paper, because it offers one big
advantage over the bare sheet and silicone mat:

最佳答案

您需要清除 <img /> 之后的 float 给力<div />正确计算高度。

为此添加 style="overflow:hidden;到开幕<div>标记,因此更新后的代码将如下所示:

<p> I expected a bigger difference between these 3 methods. The silicone mat browned the cookies a bit less than the other methods &ndash; so it can provide a little insurance if you're afraid of burnt cookies. </p>

<div style="overflow:hidden;">
<img class="wp-image-870 alignleft" style="margin-left: 2px; margin-right: 2px;" title="baking sheet cookies" src="http://cooking.blogoverflow.com/files/2012/08/IMG_3784-225x300.jpg" alt="Cookies baked on baking sheet" width="225" height="300" />
<img class="wp-image-869 alignleft" style="margin-left: 2px; margin-right: 2px;" title="silpat cookies" src="http://cooking.blogoverflow.com/files/2012/08/IMG_3787-225x300.jpg" alt="" width="225" height="300" />
<img class="alignleft size-medium wp-image-868" style="margin-left: 2px; margin-right: 2px;" title="parchment paper cookies" src="http://cooking.blogoverflow.com/files/2012/08/IMG_3790-225x300.jpg" alt="" width="225" height="300" />
</div>

<p>I'm going to stick with parchment paper, because it offers one big advantage over the bare sheet and silicone mat:</p>

您可以在此处找到有关 float 的更多详细信息:http://css-tricks.com/all-about-floats/

关于html - 不能在一行图像后强制换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11864686/

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