@import Rule - HTML CSS CSS Property

HTML CSS examples for CSS Property:import Rule

Description

The @import rule imports style rules from other style sheets.

Syntax

The syntax of @import Rule is as follows:

@import url [media type,...];

The example below shows the @import property.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html lang="en">
 <head>
  <title>Example of CSS @import rule</title>
  <style type="text/css">
  @import url("../css/layout.css");
    @import url("../css/color.css");
    body {<!--  w  ww  .  ja  v a 2s.  c  om-->
        color:blue;
        font-size:14px;
    }
</style>
 </head>
 <body>
  <div>
   <h1>Importing External Style Sheet</h1>
   <p>The layout styles of these HTML element is defined in 'layout.css' and colors in 'color.css'.</p>
  </div>
 </body>
</html>

Related Tutorials