Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unstyleing Anchor Tags in CSS

Tags:

css

I would like all the standard styles of underline, bold and color to be removed from the anchor tag so that all an anchor tag does is link and not upset the display.

I tried the following but I still have everything inside in blue and bold which is a pain.

a,
a:link,
a:visited,
a:hover,
a:active {
    color: inherit;
    text-decoration: inherit;
    font-weight: inherit;
}

Anybody know how to not just remove the style by substituting a replacement but to actually not have it style the link at all so that styles are not upset within the anchor.

like image 616
Stephen Brown Avatar asked Apr 22 '12 10:04

Stephen Brown


3 Answers

That CSS should be working. Perhaps your stylesheet isn't being loaded? Try making the font size of links obviously large with font-size:50px;, for example.

If the links become large but the colour/text-decoration/font-weight still aren't inheriting then I don't know what the problem is but if the links remain the same size then your problem lies with linking your css to your html file.

like image 83
punkrockbuddyholly Avatar answered Oct 20 '22 01:10

punkrockbuddyholly


@Drejon's answer was almost what I wanted, but explicitly setting the color, text decoration and font-weight was causing a tags to not take those values from their parent, which is what I desired. Here is what I ended up using:

a, a:link, a:visited, a:hover, a:active {
  color: inherit;
  text-decoration: inherit;
  font-weight: inherit;
}
like image 35
stephen.hanson Avatar answered Oct 19 '22 23:10

stephen.hanson


I'm not exactly sure that I understand. Try if this helps:

a,
a:link,
a:visited,
a:hover,
a:active {
    color: #000000; /*color of your choosing*/
    text-decoration: none;
    font-weight: normal;
}
like image 29
Key-Six Avatar answered Oct 20 '22 01:10

Key-Six