Importing StyleSheets

As your stylesheets become larger and larger it is recommended that you should break it into parts and then import in into the main stylesheet.

For Example, you have a main.css , header.css, footer.css. After creating these separate stylesheets you can import these into the main.css.


@import url('header.css');
@import url('footer.css');


background-color: #eaeaea;
font-family: calibri, sans-serif;
text-align: center;
font-weight: bold;


font-family: calibri, sans-serif;
font-kerning: auto;
font-size: 32px;
justify-content: flex-start;
font-family: calibri, sans-serif;
font-kerning: auto;
font-size: 26px;
justify-content: flex-start;

and here is our HTML file,


<title>DL Alpha Demo</title>
<link rel="stylesheet" href="./main.css" />
<h1 id="header">DL Alpha 0.764b</h1>
<h2 id="tagline">Tagline should go here</h2>
<div id="content">
Here goes the main content for DL Alpha 0.763b
<p id="footer">Copyrights 2014 &copy;</p>

These are not very large Stylesheet, I just want to demonstrate how to import Stylesheets into another Stylesheet 😊

Note that you must write the @import on the top of css or may be after @charset. If you add comment before these they will not going to work.

You can also specify the media type while importing stylesheet as below.

@import url('header.css'); all
@import url('footer.css'); print

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s