What is CSS @import Rule?
§ Using CSS @import rule we can include one CSS file
in another?
§ The import rule is used to import style sheets into
other style sheets and any documents where @import
can be applied.
§ The @import rule
is used to import style rules from other style sheets.
§ The @import keyword
must be followed by the URL of the style sheet to include, and a semicolon.
Syntax:
@import url("url_path");
Example:-
§ Let’s here we create an index.html page and two CSS
files example1.css and example2.css.
index.html
example1.css
example2.css
Now we embedded example1.css into index.html page
Output
Now we include example2.css in example1.css file.
Now Run this code again and check the changes
Output
This example shows how
to import style sheets into index.html directly.
Output
Post a Comment