Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS unwanted spacing between anchor-tag elements

I have this stylesheet:

*{     padding: 0px;     margin: 0px; }  a{    background:yellow;  } 

and this webpage:

<a href="/blog/">Home</a> <a href="/about/">About</a> <a href="/contact/">Contact</a>     

Results in:

enter image description here

How do I make those anchor tag to "touch" each other,removing that unwanted space in-between?

thanks Luca

like image 469
luca Avatar asked Aug 01 '11 17:08

luca


People also ask

What CSS property puts spacing between elements?

Padding is used to create space around an element's content, inside of any defined borders.

How do I add a space between tags?

The simplest way to add a space in HTML (besides hitting the spacebar) is with the non-breaking space entity, written as &nbsp; or &#160;. Multiple adjacent non-breaking spaces won't be collapsed by the browser, letting you “force” several visible spaces between words or other page elements.


1 Answers

You need to remove the whitespace (in this case the newline) between your tags. Some browsers render it as a space.

like image 161
Alex Feinman Avatar answered Sep 29 '22 04:09

Alex Feinman