Extra spacing after an A Tag/img tag?(A 标签/img 标签后的额外间距?)

本文介绍了A 标签/img 标签后的额外间距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试使用 div 标签构建表格单元格,同时这样做.我在单元格中添加了一个标签后,我得到了这个额外的间距.

<div 显示:行><div 显示:表格单元格><a><img/></a>

我似乎无法弄清楚如何摆脱多余的间距.

我为 a 和 img 标签尝试了 display:inline.但不是运气.

如果有人可以帮助我摆脱这种间距,我将不胜感激.

示例 -- 就在阴影之前,此表格单元中有 2-3 像素的空白

解决方案

除了表格数据应该使用表格之外,我认为在图像上设置 display: block 将删除空间.如果这不起作用,请尝试制作一个 jsFiddle 页面来展示问题.

Hello i'm trying to build a table cell using div tag and while doing so. 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. 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

解决方案

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. If that doesn' work, try to make a jsFiddle page to show off the problem.

这篇关于A 标签/img 标签后的额外间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!