-
User preference
The user always has the final choice about what styles are used. Users aren’t required to use any styles at all and can always change the style sheet for their own local copy of the page. If a user needs to apply a special style (for example, high contrast for people with visual disabilities), he should always have that option.
-
Local style
A local style (defined with the style attribute in the HTML) has the highest precedence of developer-defined styles. It overrules any other styles.
-
id
A style attached to an element id has a great deal of weight because it overrides any other styles defined in the style sheet.
-
Class
Styles attached to a class override the style of the object’s element. So, if you have a paragraph with a color green that belongs to a class colored blue, the element will be blue because class styles outrank element styles.
-
Element
The element style takes precedence over any of its containers. For example, if a paragraph is inside a div, the paragraph style has the potential to override both the div and the body.
-
Container element
divs, tables, lists, and other elements used as containers pass their styles on. If an element is inside one or more of these containers, it can inherit style attributes from them.
-
Body
Anything defined in the body style is an overall page default, but it will be overridden by any other styles.
Väli
Button Colors
Change the background color of a button with the background-color property:
Text Buttons
Text buttons with a specific background color on hover:
Hae