Import from Another Stylesheet

Description

You can import styles from one stylesheet into another using the @import statement.

Example

The following code is from combined.css File. It imports the content from the styles.css.


@import "styles.css";
span  {
    border: medium black dashed;
    padding:  10px;
}

You can import as many stylesheets as you want, using one @import statement per stylesheet.

The @import statements must appear at the top of the stylesheet, before any new styles are defined.

The following code links to a Stylesheet That Contains Imports


<!DOCTYPE HTML>
<html>
    <head>
       <link rel="stylesheet"  type="text/css"  href="combined.css"/>
    </head>
    <body>
        <a href="http://java2s.com">Visit the  website</a>
        <p>I  like <span>apples</span> and  oranges.</p>
        <a href="http://w3c.org">Visit the   W3C  website</a>
    </body>
</html>





















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