Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore parent css style

Tags:

css

I'm wondering how to ignore a parent style and use the default style (none). I'll show my specific case as an example but I'm pretty sure this is a general question.

<style> #elementId select {     height:1em; } </style>  <div id="elementId">     <select name="funTimes" style="" size="5">         <option value="test1">fish</option>         <option value="test2">eat</option>         <option value="test3">cows</option>     </select> </div> 

Ways I do not want to solve this problem:

  • I cannot edit the stylesheet where the "#elementId select" is set, my module won't have access that.
  • Preferably not override the height style using the style attribute.

For example using firebug i can turn off the parent style and all is well, this is the effect I am going for.

Once a style is set, can it be disabled or must it be overridden?

like image 735
SeanDowney Avatar asked Jun 03 '09 19:06

SeanDowney


People also ask

How do I ignore a class in CSS?

In CSS, to exclude a particular class, we can use the pseudo-class :not selector also known as negation pseudo-class or not selector. This selector is used to set the style to every element that is not the specified by given selector. Since it is used to prevent a specific items from list of selected items.

How do you override a CSS property?

To override the CSS properties of a class using another class, we can use the ! important directive. In CSS, ! important means “this is important”, and the property:value pair that has this directive is always applied even if the other element has higher specificity.


1 Answers

You could turn it off by overriding it like this:

height:auto !important;

like image 85
Fabian Brenes Avatar answered Sep 18 '22 15:09

Fabian Brenes