Skip to main content
Commonmark migration
Source Link

I learned about selector precedence from this [tutorial][1]tutorial. I have trouble understanding the behavior of this in one case. I have an element in HTML:

<input class="top_bar_login_form_input" type="text" name="email" placeholder="Prijavno ime"> 

The problem is that properties from another selector override the properties from the class.

![Picture][2]Picture

As shown in the picture above the class gets overridden by a less specific selector. The element gets selected by input[type="text"], which is less specific than a class. The only reasoning behind these behavior that I see is that the .inputbox class is also calculated in determining the precedence, even though it doesn't match the element.

Why does the type selector override the class selector? [1]: http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/ [2]: https://i.sstatic.net/4OXKZ.png

I learned about selector precedence from this [tutorial][1]. I have trouble understanding the behavior of this in one case. I have an element in HTML:

<input class="top_bar_login_form_input" type="text" name="email" placeholder="Prijavno ime"> 

The problem is that properties from another selector override the properties from the class.

![Picture][2]

As shown in the picture above the class gets overridden by a less specific selector. The element gets selected by input[type="text"], which is less specific than a class. The only reasoning behind these behavior that I see is that the .inputbox class is also calculated in determining the precedence, even though it doesn't match the element.

Why does the type selector override the class selector? [1]: http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/ [2]: https://i.sstatic.net/4OXKZ.png

I learned about selector precedence from this tutorial. I have trouble understanding the behavior of this in one case. I have an element in HTML:

<input class="top_bar_login_form_input" type="text" name="email" placeholder="Prijavno ime"> 

The problem is that properties from another selector override the properties from the class.

Picture

As shown in the picture above the class gets overridden by a less specific selector. The element gets selected by input[type="text"], which is less specific than a class. The only reasoning behind these behavior that I see is that the .inputbox class is also calculated in determining the precedence, even though it doesn't match the element.

Why does the type selector override the class selector?

Precedence in cssCSS selector specifity conflicts (type vs class selector)

edited tags; added 9 characters in body
Source Link
BoltClock
  • 728.3k
  • 165
  • 1.4k
  • 1.4k

I learned about selector precedence from this [tutorial][1]. I have trouble understanding the behavior of this in one case. I have an element in htmlHTML:

<input class="top_bar_login_form_input" type="text" name="email" placeholder="Prijavno ime"> 

The problem is that properties from another selector overideoverride the properties from the class.   

![Picture][2]

As shown in the picture above the class gets overiddenoverridden by a less specific selector. The element gets selected by input[type="text"]input[type="text"], which is less specific than a class. The only reasoning behind these behavior that I see is that the .inputbox.inputbox class is also calculated in determining the precedence, even though it doesntdoesn't match the element.

Why does the type selector override the class selector? [1]: http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/ [2]: https://i.sstatic.net/4OXKZ.png

I learned about selector precedence from this [tutorial][1]. I have trouble understanding the behavior of this in one case. I have an element in html:

<input class="top_bar_login_form_input" type="text" name="email" placeholder="Prijavno ime"> 

The problem is that properties from another selector overide the properties from the class.  ![Picture][2]

As shown in the picture above the class gets overidden by a less specific selector. The element gets selected by input[type="text"], which is less specific than a class. The only reasoning behind these behavior that I see is that the .inputbox class is also calculated in determining the precedence, even though it doesnt match the element.

Why does the type selector override the class selector? [1]: http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/ [2]: https://i.sstatic.net/4OXKZ.png

I learned about selector precedence from this [tutorial][1]. I have trouble understanding the behavior of this in one case. I have an element in HTML:

<input class="top_bar_login_form_input" type="text" name="email" placeholder="Prijavno ime"> 

The problem is that properties from another selector override the properties from the class. 

![Picture][2]

As shown in the picture above the class gets overridden by a less specific selector. The element gets selected by input[type="text"], which is less specific than a class. The only reasoning behind these behavior that I see is that the .inputbox class is also calculated in determining the precedence, even though it doesn't match the element.

Why does the type selector override the class selector? [1]: http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/ [2]: https://i.sstatic.net/4OXKZ.png

added 59 characters in body
Source Link
Borut Flis
  • 16.5k
  • 31
  • 101
  • 133
Loading
Source Link
Borut Flis
  • 16.5k
  • 31
  • 101
  • 133
Loading