CSS @import Rule
- Introduction to CSS @ import rule
- Syntax of CSS @ import rule
- Values of CSS @ import rule
Introduction to CSS @import Rule
CSS styles can be defined in many ways for any HTML page. For example, you can also define CSS style inside the HTML file or you can define all the styles in it by creating an external file.
When you create a large web application, it defines a lot of CSS styles to design. If you define these styles within the HTML file then it is so much that you can not manage them.
Because when you define CSS inside the HTML file, it is not categorized. Whenever you need to make any changes, then you have to search the entire HTML file.
In addition, when you define a lot of CSS styles in the HTML file, it also affects the loading speed of the page. In these situations, the @import rule has been introduced in CSS.
You can import CSS styles from other style sheets via CSS @import rule. A stylesheet is a file that contains many defined CSS styles. A style sheet is saved with the .css extension.
You can also include an external stylesheet in the webpage by using the <link> tag. When you use the <link> tag, it is allowed parallel loading. That means more than one stylesheet can load simultaneously.
But when you use the @import rule, parallel loading is not allowed. This means that if you import more than one stylesheet into an HTML file, the loading of the second stylesheet will not start until the first stylesheet loads completely.
You can also define media type (Computer, laptop, mobile, etc.) with CSS @import rule. That is, you can define that the style sheet to be imported, which type of media type will apply.
In addition to the media type you can also define complete media query with this rule. Media types can also define in <link> tag.
The use of CSS @import rule is very less. However, this rule is very useful in many situations. For example, Unless there is a special stylesheet load, the rest of the stylesheets are not loaded, you can use it for it.
Syntax of CSS @import Rule
The general syntax of the CSS @import rule has been given below.
@import url ("url-of-stylesheet-here");
If you do not want to define the URL () function, you can also directly define the URL as a single string as well.
@import url-of-stylesheet-here;
Media type or media query can also be defined with a @import rule. These are defined at the end of the URL.
@import url ("url-of-stylesheet-here") media-type / media-query;
For more information regarding media types and media queries, you can read the @media rule tutorial.
Example of CSS @import Rule
A simple example of CSS @import rule has been given below.
mbhWebPage.html
<!DOCTYPE html>
<html>
<head>
<title> CSS @import Rule Example </title>
<style>
@import url("mbh.css");
</style>
</head>
<body>
<h1> MyBlogHelp </h1>
<p>MyBlogHelp is a website where articles are shared like Blogging, SEO, Web Design, Web Development, HTML, CSS and Computer related all Tips.</p>
<style>
@import url("mbh.css");
</style>
</head>
<body>
<h1> MyBlogHelp </h1>
<p>MyBlogHelp is a website where articles are shared like Blogging, SEO, Web Design, Web Development, HTML, CSS and Computer related all Tips.</p>
</body>
</html>
mbh.css
body{
width: 30%;
}
h1
{
color: red;
font-size: 50px;
font-weight: bold;
margin: 30px
}
p
{
color: blue;
font-size: 25px;
font-weight: bold;
font-style: oblique;
}
width: 30%;
}
h1
{
color: red;
font-size: 50px;
font-weight: bold;
margin: 30px
}
p
{
color: blue;
font-size: 25px;
font-weight: bold;
font-style: oblique;
}
Hey! This post could not be written any better! Reading through
ReplyDeletethis post reminds me of my good old room mate! He always kept chatting about
this. I will forward this write-up to him. Pretty sure
he will have a good read. Thank you for sharing!
Good post.Never knew this, regards for letting me know.
ReplyDeleteI definitely wanted to send a simple remark to thank you for
ReplyDeletethese great steps you are writing on this site. My time intensive internet search has at the end of the day been rewarded with wonderful knowledge to go over with my close friends.
I 'd suppose that many of us website visitors actually are unquestionably blessed
to exist in a good site with very many lovely people with good advice.
I feel extremely lucky to have discovered your web pages and
look forward to many more fun moments reading here.
Thanks again for everything.
It's not my first time to go to see this website, i am visiting this web
ReplyDeletesite dailly and get good information from here daily.
I was able to find good information from your articles.
ReplyDeleteIt's an amazing paragraph for all the web viewers; they will get benefit from it
ReplyDeleteI am sure.
What's up, everything is going fine here and ofcourse every one is
ReplyDeletesharing data, that's really excellent, keep up writing.
It's difficult to find knowledgeable people in this particular
ReplyDeletesubject, but you sound like you know what you're talking about!
Thanks
I don't ordinarily comment but I gotta state thank you for the
ReplyDeletepost on this special one :D.
hello!,I like your writing so much! percentage we communicate
ReplyDeletemore approximately your article on AOL? I need a
specialist on this space to resolve my problem. May be that is you!
Having a look forward to peer you.
I really like what you guys tend to be up too.
ReplyDeleteThis type of clever work and reporting! Keep up the very good works guys
I've included you guys to our blogroll.
Wohh precisely what I was looking for, regards for putting up.
ReplyDeleteHi there i am kavin, its my first time to commenting anyplace,
ReplyDeletewhen i read this piece of writing i thought i could also make comment
due to this brilliant piece of writing.
Wow, that's what I was exploring for, what a information! existing here
ReplyDeleteat this web site, thanks admin of this site.
I visited several websites but the audio quality for audio songs current at this web site
ReplyDeleteis in fact superb.
I was just looking for this info for a while. After six hours of continuous Googleing, finally I got it in your site.
ReplyDeleteI wonder what is the lack of Google strategy that do not rank this type
of informative sites in top of the list. Generally the top web sites
are full of garbage.
Every weekend i used to pay a quick visit this
ReplyDeletesite, because i want enjoyment, as this this web
page conations genuinely fastidious funny stuff
too.
I went over this internet site and I believe you have a
ReplyDeletelot of excellent information, bookmarked (:.
I went over this website and I conceive you have a lot
ReplyDeleteof fantastic information, saved to my bookmarks (:.
I am no longer positive where you are getting your information, however great topic.
ReplyDeleteI must spend some time learning much more or understanding
more. Thanks for wonderful info I used to be on the lookout for
this info for my mission.
F*ckin' amazing things here. I am very satisfied
ReplyDeleteto see your article. Thank you a lot and i'm having a look forward to contact
you. Will you please drop me a e-mail?
Really good visual appeal on this website, I'd rate it 10.
ReplyDeleteI have been exploring for a little bit for any high quality
ReplyDeletearticles or blog posts in this kind of space .
Exploring in Yahoo I eventually stumbled upon this website.
Studying this info So i'm glad to show that I've
a very just right uncanny feeling I came upon exactly what I needed.
I so much undoubtedly will make certain to don't disregard this site and give it a
glance on a continuing basis.
Great post however I was wanting to know if you could write a litte more on this topic?
ReplyDeleteI'd be very thankful if you could elaborate a little bit further.
Thanks!
Spot on with this write-up, I honestly feel this website
ReplyDeleteneeds a great deal more attention. I'll probably be returning to read through
more, thanks for the info!
Hi there, I found your web site by means of Google
ReplyDeleteeven as searching for a related matter, your site came up, it seems great.
I've bookmarked it in my google bookmarks.[X-N-E-W-L-I-N-S-P-I-N-X]Hi there, simply turned into alert to your weblog through Google,
and located that it's truly informative. I'm going to be careful for brussels.
I will appreciate when you proceed this in future.
Many other folks will probably be benefited out of your writing.
Cheers!
Hi! This post could not be written any better! Reading this post reminds me
ReplyDeleteof my old room mate! He always kept talking about this.
I will forward this write-up to him. Pretty sure he will have a good read.
Many thanks for sharing!
Undeniably consider that which you stated. Your favorite reason appeared to be
ReplyDeleteat the net the simplest thing to take into account of.
I say to you, I certainly get irked at the same time
as other people think about concerns that they just do not know about.
You controlled to hit the nail upon the highest and
defined out the entire thing with no need side-effects , other folks can take a signal.
Will likely be back to get more. Thanks
You completed various nice points there. I did a search on the theme and found nearly all persons will have the same opinion with your blog.
ReplyDeleteI really like looking through an article that can make men and women think.
ReplyDeleteAlso, many thanks for permitting me to comment!
Hello, Neat post. There is an issue with your site in web
ReplyDeleteexplorer, might test this? IE still is the marketplace leader and a huge element of folks
will leave out your excellent writing because of this problem.
Wow, wonderful weblog format! How long have you ever been blogging for?
ReplyDeleteyou make running a blog look easy. The entire look of your web site is magnificent, as smartly as the content material![X-N-E-W-L-I-N-S-P-I-N-X]I simply
couldn't depart your web site before suggesting that I really enjoyed the usual information a person provide for
your visitors? Is gonna be again continuously to investigate cross-check new posts.
When someone writes an paragraph he/she keeps the idea
ReplyDeleteof a user in his/her mind that how a user can be aware
of it. So that's why this post is perfect. Thanks!
This paragraph will help the internet users for building up new weblog
ReplyDeleteor even a blog from start to end.
Wow, marvelous weblog structure! How lengthy have you been running
ReplyDeletea blog for? you make running a blog look easy.
The total glance of your website is wonderful, let alone the content material![X-N-E-W-L-I-N-S-P-I-N-X]I
just couldn't leave your website prior to suggesting that
I really loved the usual info an individual supply to your guests?
Is gonna be back ceaselessly to check out new posts.
Everything is very open with a clear description of the challenges.
ReplyDeleteIt was really informative. Your website is useful.
Many thanks for sharing!
Hey there would you mind letting me know which webhost you're working with?
ReplyDeleteI've loaded your blog in 3 completely different web browsers and I
must say this blog loads a lot quicker then most.
Can you suggest a good hosting provider at a
honest price? Kudos, I appreciate it!
I have been absent for a while, but now I remember why I used to love
ReplyDeletethis website. Thank you, I will try and check back more
frequently. How frequently you update your web site?
Right away I am going to do my breakfast, after having my breakfast coming yet again to read more news.
ReplyDeleteRight away I am going to do my breakfast, after having my breakfast coming again to read additional news.
ReplyDelete