为什么这些链接有余量? CSS

时间:2022-01-08 03:52:25

Here's the JSFiddle: http://jsfiddle.net/bozdoz/k2enx/

这是JSFiddle:http://jsfiddle.net/bozdoz/k2enx/

Margin for #topLinks a is set to 0, so I don't see why there is a space between the links. I set the background to red so you can see the margins.

#topLinks a的保证金设置为0,所以我不明白为什么链接之间有空格。我将背景设置为红色,以便您可以看到边距。

为什么这些链接有余量? CSS

I would like to remove the blue vertical lines in between the anchor elements. I have done this before, but I can't seem to get it to work in this circumstance for some reason. Any suggestions?

我想删除锚元素之间的蓝色垂直线。我以前做过这个,但由于某些原因,我似乎无法在这种情况下使用它。有什么建议么?

1 个解决方案

#1


3  

It's not margin, its a space. As the links are inline elements any whitespace between them is converted into a single space. Remove newlines from between the links:

这不是边际,它是一个空间。由于链接是内联元素,因此它们之间的任何空格都会转换为单个空格。从链接之间删除换行符:

<a href="#">Home</a><a href="#">Profession</a><a href="#">about</a>

#1


3  

It's not margin, its a space. As the links are inline elements any whitespace between them is converted into a single space. Remove newlines from between the links:

这不是边际,它是一个空间。由于链接是内联元素,因此它们之间的任何空格都会转换为单个空格。从链接之间删除换行符:

<a href="#">Home</a><a href="#">Profession</a><a href="#">about</a>