Alexander Bird
Alexander Bird

Reputation: 40649

CSS: clear all formatting of anchor tag

I have a site where the page is formatted to be 800px wide with an image taking up the top 40 pixels. I wrapped the image with an anchor tag so that clicking on the image takes user to home page. When I wrap the image with an anchor tag, the image seems to shift to the right a little bit which throws of the alignment!

Is there a way I can clear absolutely all formatting from an anchor tag?

Upvotes: 1

Views: 6724

Answers (2)

Alexander Bird
Alexander Bird

Reputation: 40649

David is right in his comment; Every style for the anchor tag (border, margin, color, :visited, etc) has to be individually undone. BoltClock's suggestion is sufficient for me, but for anyone else who truly does want to reset any tag, try looking at Yahoo's reset CSS (http://developer.yahoo.com/yui/3/cssreset/).

Upvotes: 3

BoltClock
BoltClock

Reputation: 723779

Must be the classic image border issue that adds a visible border to your image if it's a hyperlink. Try this (if you wish, edit the a img part to only target your header or the image ID or something):

a img {
    border: 0;
}

Upvotes: 4

Related Questions