- This topic is empty.
September 19, 2013 at 9:53 am #150599CodeGirl79Participant
Hello my seasoned CSS friends! I am new to learning how to code. As we quickly brushed over it in school I decided to take it upon myself to learn html and CSS like the back of my hand. I want to learn it the right way. I’m reading a book Beginning CSS Web Development -Simon Collison and it talks about the different ways to use CSS in your HTML document. One of which is a little confusing to me… @import.
Could someone tell me more about @import vs linking in css. I researched other articles online and have found this to be a sliding subject of preference. Which is better to use? Should you use both at the same time (is that even possible)? Please educate me on this topic.
Thanks-September 19, 2013 at 10:24 am #150602georgearnallParticipant
I may not be correct here but I am sure I read somewhere that it is better to use because it can download them at the same time whereas @import is one after another.
However, in reality you should really just concatenate, compress and use one file.September 19, 2013 at 12:19 pm #150608rkieruParticipant
However, in reality you should really just concatenate, compress and use one file.
For the purposes of development I tend to rely
@importfor the simple ease of being able to break CSS into smaller component files so that it’s just that much easier to work with and bug test. For production you’re much better off combining them into a single CSS file.
As georgearnall mentioned though; if you ARE going to use one of these in a live site the preferred method is
<link>because it allows for multiple HTTP requests to be made whereas the
@importmethod does not.September 27, 2013 at 8:17 am #151482CodeGirl79Participant
Thank you both for your input on this topic. Your information was helpful. Thanks-
- The forum ‘Other’ is closed to new topics and replies.