1.

How to draw a triangle using CSS?

Answer»

In CSS, SAY if you have two conflicting styles for an element, the browser should decide which one to apply and render. This is chosen by the browser-based on specificity. Specificity is nothing but a set of rules. Some of the rules are mentioned below.

  1. Say- if you have two element selectors selecting the same element but having different styles. The element selector which is read LATEST by the browser will get APPLIED
  2. The element selector has less priority compared to a class selector. So, the styles WRITTEN in the class selector gets applied.
  3. The class selector has less priority compared to an ID selector. So, the styles written in the ID selector gets applied.
  4. If we use !important along with the value for a CSS property. This style gets applied no MATTER it’s a class or an element or an ID selector.


Discussion

No Comment Found