Styles Cascade - HTML CSS CSS

HTML CSS examples for CSS:Introduction

Introduction

The order in which the browser will look for a property value when it comes to display an element.

  • Inline styles -- styles that are defined using the style global attribute on an element
  • Embedded styles -- styles that are defined in a style element
  • External styles -- styles that are imported using the link element
  • User styles -- styles that have been defined by the user
  • Browser styles -- the default styles applied by the browser

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

Demo Code

ResultView the demo in separate window

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

Related Tutorials