Html 如果图片与一侧对齐,则在图片下方移动文本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9223127/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:26:08  来源:igfitidea点击:

Move text below picture if picture is aligned to the side

htmlcssalignment

提问by HelpNeeder

I have a image and text. The image is aligned to the left because I want to the text to be next to the image. Both, image and text, are in a <p></p>.

我有图片和文字。图像向左对齐,因为我希望文本位于图像旁边。图像和文本都在一个<p></p>.

Now. I want to insert additional text which would show under previous text and the picture.

现在。我想插入将显示在先前文本和图片下方的附加文本。

How to do this?

这该怎么做?

Some code:

一些代码:

<p><img src="image.gif" align="left" width="300" height="200"> Good paragraph of text</p>
<p>Text that I want to appear below the text and the image above</p>

回答by paislee

The simplest solution is to add a CSS style attribute to the second plike:

最简单的解决方案是向第二个添加 CSS 样式属性,p例如:

<p style="clear: both;">