Thursday 22 July 2021

CSS import rule

 CSS @import Rule


The @import rule allows you to import a style sheet into another style sheet.


The @import rule must be at the top of the document (but after any @charset declaration).



@import "sps.css"; /* Using a string */


or


@import url("sps.css"); /* Using a url */




For Example:

a1.css


h2{color:blue; }


abc.css


@import "a1.css";

h1{color:red; }


<html>

<head>

<title>CSS+HTML</title>

<link rel="stylesheet" href="abc.css"/>

<!--<style>

h1{color:red; }

h2

{

color:blue; 

}

</style>

-->

</head>

<body>

<!--

<h1> <font color="red">Hello from HTML</font></h1>

<h2><font color="blue">Hello from HTML</font></h2>

<h1><font color="red">Hello from HTML</font></h1>

<h2><font color="blue">Hello from HTML</font></h2>

<h1><font color="red">Hello from HTML</font></h1>

<h2><font color="blue">Hello from HTML</font></h2>

-->


<h1>Hello from HTML</h1>

<h2>Hello from HTML</h2>

<h1 style="color:green;">Hello from HTML</h1>

<h2>Hello from HTML</h2>

<h1>Hello from HTML</h1>

<h2>Hello from HTML</h2>


</body>

</html>

No comments:

Post a Comment