html - 检查我的 CSS。随机边距

标签 html css margin

<分区>

每个图像之间出现随机空间。我希望让它们粘在一起,但我不知道该怎么做,无论我做什么...

HTML:

<div class="nav">
<a href="enconstruction.php"><img src="images/barre3/Environnement Gris.png" class="img1"></a>
<a href="inter.php"><img src="images/barre3/Services publics gris.png" class="img2"></a>
<a href="enconstruction.php"><img src="images/barre3/droits syndicaux gris.png" class="img3"></a>
<a href="mob.php"><img src="images/barre3/mobilisation Gris.png" class="img4"></a>
<a href="index.php"><img src="images/barre3/Home gris.png" class="img5"></a>

和 Css:

.nav
{
position:fixed;
bottom:-4px;
width:auto;
height:150px;
margin:0 auto;
z-index:5;
}

.img1
{
position:relative;
width:180px;
height:auto;
}

.img2
{
position:relative;
width:212px;
height:auto;
}

.img3
{
position:relative;
width:245px;
height:auto;
}

.img4
{
position:relative;
width:218px;
height:auto;
}

.img5
{
position:relative;
width:165px;
height:auto;
}

最佳答案

内联元素对代码中的空格敏感。您可以通过以下方式摆脱它:

  • 删除空格 </a><a href=...
  • 在元素之间放置 HTML 注释 </a><!-- --><a href=
  • 将父级的字体大小设置为零

关于html - 检查我的 CSS。随机边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27952546/

上一篇:css - Wordpress:第一个博客条目消失(仅在 Firefox 中!)

下一篇:javascript - 根据 X/Y 位置更改鼠标光标

相关文章:

javascript - 如何将第二个图表添加到谷歌图表的仪表板中?

css - Ag-Grid:修改单个列标题的 css/样式?

html - Scratch off reveal with HTML5 canvas -- 添加淡出元素

javascript - 定位到行中的最后一里?

css - Bootstrap 行中的间距和填充/边距

html - 在 Twitter Bootstrap 中,当我最小化我的窗口时,我的旋转木马失去宽度和高度以平衡,这很好但随后留下了巨大的差距

html - 使用 bootstrap 的嵌套布局导致错位

html - DL像一张 table

java - Jsoup, '&gt;' 的问题相关转换

html - Safari 错误边距 - 在 Chrome 和 FF 中工作正常