简体   繁体   English

A标签/ img标签后的额外间距?

[英]Extra spacing after an A Tag/img tag?

Hello i'm trying to build a table cell using div tag and while doing so. 您好我正在尝试使用div标签构建表格单元格,同时这样做。 i get this extra spacing after my img a tag within the cell. 我在单元格中嵌入了一个标签后得到了这个额外的间距。

<div display:table>
 <div display:row>
  <div display:tabel-cell>
   <a><img/></a>

I can't seem to figure out how to get rid of that extra spacing. 我似乎无法弄清楚如何摆脱额外的间距。

i tried display:inline for the a and img tag. 我试过显示:内联a和img标签。 yet not luck. 但没有运气。

if anyone can help me get rid of this spacing i would gladly appreciate it. 如果有人能帮助我摆脱这个间距我会很乐意欣赏它。

Example -- right before the shadowing there a 2-3 pixel white space within this tabel-cell 示例 - 在阴影之前,此tabel单元格中有一个2-3像素的空白区域

http://i.imgur.com/DLPWH.png

Aside from the fact that you should use tables for tabular data, I think that setting display: block on the image will remove the space. 除了你应该使用表格表格数据这一事实,我认为在图像上设置display: block将删除空格。 If that doesn' work, try to make a jsFiddle page to show off the problem. 如果这不起作用,请尝试制作一个jsFiddle页面来展示问题。

可以使用以下方法删除该空间:

style="display:block;"

Try setting margin: 0 and padding: 0 on the elements that have this extra spacing. 尝试在具有此额外间距的元素上设置margin: 0padding: 0 It is usually a good idea to implement some sort of CSS Reset to make sure all elements are cleared of these annoying default attributes such as margins and padding. 实现某种CSS重置通常是一个好主意,以确保所有元素都清除了这些烦人的默认属性,如边距和填充。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM