我应该在图像周围放置段落标签吗? [英] Should I put paragraph tags around images?
问题描述
我有一个网页,其中包含带图像的文字。我写了一些文字(在一个段落中),然后放了一个图像,然后是另一个段落。
I have a web page where I have text with images. I write some text (in a paragraph) then put an image, then another paragraph.
我是否应该在图像周围加上p标签,或者我应该把它留在只有img标签之间?
Should I put p tags around the image too, or should I just leave it in between with just the img tag?
我之所以这么说是因为到目前为止,我只是在段落间插入图像,但现在如果我想添加多个图像或添加图像,一个锚,然后不要坐在一起。我尝试的另一件事是添加
The reason I ask this is because up until now I was just plopping images in between paragraphs, but now if I want to add more than one image or add an image and an anchor then the don't sit together right. The other thing I tried was adding
<p></p>
但我觉得这是错误的:P
in between two images but I feel like that is wrong :P
推荐答案
您可以使用CSS将图像作为块而不是内联块:
You could use CSS to make the images act as blocks rather than as inline-blocks:
将以下内容放在你的CSS中:
Put the following in your CSS somewhere:
img { display: block; }
或者如果你想要一些内联显示的图像,那么添加 class =block
到您的img标签,并将css更改为:
Or if you have some images that you want to display inline, then add class="block"
to your img tags, and change the css to this:
img.block { display: block; }
这篇关于我应该在图像周围放置段落标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!