Voted Best Answer
 
                
Jan 05, 2009 - 10:40 PM
First some background:
A normal hyperlink in HTML is created with the tag.
tags are per default 'inline' elements, and as such should always appear inside a 'block' level element, usually
.
Inline elements cannot have top or bottom margins:
http://www.w3.org/TR/CSS21/box.html#m...
(quote) "[...] vertical margins will not have any effect on non-replaced inline elements."
Setting vertical margins on these elements will simply be ignored.
(A 'replaced inline element', in case you were wondering, is for instance an inline image, which CAN have vertical margins.)
You can set horizontal (left and right) margins, though:
a.myLink
{
margin-left: 10px;
}
If your link is not part of a paragraph, you can consider turning it into a block level element and then you will be free to give it margins as you wish:
a.myLink
{
display: block;
margin: 5px 10px;
}
Best regards,
Jakob 

 
                
 
                 
                             
                            

 
        
Add New Comment