Importing from Another Stylesheet - HTML CSS CSS

HTML CSS examples for CSS:Introduction

Introduction

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

combined.css file has the following content.

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

Linking to a Stylesheet That Contains Imports

<!DOCTYPE HTML>
<html>
    <head>
        <title>Example</title>
        <link rel="stylesheet" type="text/css" href="combined.css"/>
    </head>
    <body>
        <a 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