Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

margin-top not working

Status
Not open for further replies.

georgeocrawford

Technical User
Aug 12, 2002
111
0
0
GB
Here's some html:

Code:
<b>My details</b><br />
<a class="normal" href="myurl">Edit Details</a>

and here's the CSS:

Code:
		body {
		background : #ddd;
		font-family: Verdana, Arial, Helvetica, sans-serif;
		color: #0066cc;
		margin: 50px 10%;
		}

		a {
		color : #000;
		text-decoration : none;
		}

		a.normal {
		background: #fef;
		padding: 3px;
		border: 2px solid #333;
		font-size: 13px;
		margin-top: 15px;
		}

Can someone please tell me why the margin-top value for a.normal is ignored in this example. Whatever I set it to, from 5px to 90%, it makes no difference to the result. Am I being stupid???

______________________

George
 

I'm guessing because it is an inline element. If you change it to a block element, the margin works fine... although it is less-than desirable as a block element!

Dan

 
Thanks. I thought that might be the case. So no way of shifting it using margin? I guess I'll have to use relative positioning or something.

______________________

George
 
How about you tell us what you're trying to do. Maybe line-height could be of assistance.
 
Exactly what I wanted! I completely forgot about line-height. I had links with borders around them, and the top border was overlapping the text on the line above. Line-height solved it perfectly.

Many thanks!

______________________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top