我如何摆脱< img> html页面中的行中的元素?
问题描述:
我像这样连续显示3 < img>
:
I'm displaying 3 <img>
in a row like this:
<div style="width: 950px">
<img src='/UploadedImages/86.jpg' alt='' style="width: 300px; margin: 0px; padding: 0px; border: 1px solid Black" />
<img src='/UploadedImages/85.jpg' alt='' style="width: 300px; margin: 0px; padding: 0px; border: 1px solid Black" />
<img src='/UploadedImages/84.gif' alt='' style="width: 300px; margin: 0px; padding: 0px; border: 1px solid Black" />
</div>
正如您所看到的,我在图像周围留有细小的黑色边框。我的问题是在相邻图像的边界之间存在大约5px宽的空白区域,我已将边距设置为0px,但不起作用。那么这里发生了什么?
As you can see I have thin black borders around the images. My problem is that there are white spaces about 5px wide between the borders of neighbouring images and I have set the margin to be 0px but it does not work. So what is happening here?
答
您必须移除标记之间的空格(换行符和空格):
You have to remove the whitespaces (linebreaks & spaces) between the tags:
<img src='/UploadedImages/86.jpg' alt='' style="..." /><img src='/UploadedImages/85.jpg' alt='' style="..." />
或发表评论以保持换行:
or make comments to keep linebreaks:
<img src='/UploadedImages/86.jpg' alt='' style="..." /><!--
--><img src='/UploadedImages/85.jpg' alt='' style="..." />