Important Styles

Description

You can override the normal cascade order by marking your property values as important.

Example

You mark individual values as important by appending !important to the declaration.


<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style type="text/css">
a  {<!--from   w w w  .  ja  v  a 2 s  .c o m-->
   color:  black !important;
}
</style>
</head>
<body>
    <a style="color:red" href="http://java2s.com">Visit the  website</a>
    <p>This is a text.</p>
    <a href="http://w3c.org">Visit the   W3C  website</a>
</body>
</html>

Click to view the demo

The browser gives preference to important styles, regardless of where they are defined.

You can see the effect of property importance. The embedded value for the color property overrides the inline value.





















Home »
  HTML CSS »
    CSS »




CSS Introduction
CSS Background
CSS Border
CSS Box Layout
CSS Text
CSS Font
CSS Form
CSS List
CSS Selectors
CSS Others
CSS Table