How to stop a CSS rule from applying to a specific element [duplicate]


Tags: javascript,jquery,html,css

Problem :

I have a CSS rule like so:

a {
  line-height: 50px;
  display: inline-block;
  text-decoration: none;
  font-size: 16px;
  color: white;
}

And this HTML:

<a href="/test">test</a>

How can I stop the CSS rule applying to just this element?



Solution :

Thank you everyone for the suggestions, but the following answer worked perfectly for me:

a.none {
  line-height: inherit;
  display: inherit;
  text-decoration: inherit;
  font-size: inherit;
  color: inherit;
}

Create that class and then attach it to the a tag like this:

<a class="none" href="/test">test</a>

Someone posted this before and then deleted it, i don't know why, but thank you!


    CSS Howto..

    How to select not first tr and not last td

    How to display a number (generated dynamically) into a square using CSS

    How Do I Place An Image To The Right of a Body of Text?

    How to define dynamic height in css (or html)?

    How to get css value of an element inside array?

    Show / Hide HTML using swatch / HTML 5 - dynamic HTML

    How to transform a button into this styled button

    How to add nav icon images using max-width property in CSS

    How to create a medal in css [closed]

    How to show the text overflow after showing two lines in the div using css?

    Greasemonkey: How to do something when style=“display: none;” changes?

    How to apply css to an iframe

    How to bundle Angular 2 component css?

    How to open links in a new tab/window using CSS? [duplicate]

    How to change img margin inside a table using css hover

    Unsure how to use border-bottom in CSS

    How to horizontally center-align the content of a div by manipulating the CSS of the wrapper div only?

    How to use CSS with javascript

    How to GPU accelerate CSS transform?

    How to apply css style on the list of div by defending on the class name using javascript

    How can I set a css property to tags with specific attribute?

    Bootstrap: Background image z-index to show it above bg color

    How do I add an image to a progress bar in HTML/CSS?

    How to put text and image in a same line?

    How to use CSS Class and ID selectors

    CSS/JQuery: A scrolling, overlay div and a centered layout - how to get it in a somewhat fixed position?

    How can I enable CSS selector profiling in Chrome

    How to double an image size in HTML using only CSS?

    How to add new CSS rule to inner id

    PHP: How to add a CSS text-align property to an already present inline style attribute of an element using simple_html_dom parser?