CSS

merideth murdock
merideth murdock
2,033 Points

Why @import instead of copy and paste?

I'm struggling with understanding the use of @import. I understand that it's basically CSS version of <link> but I don't understand why you wouldn't just copy and paste all the code from the file you're importing, to the CSS file you're doing. Wouldn't you want all of the CSS to be right there to manipulate anyways instead of jumping to different CSS files?

1 Answer

Martin Sole
Martin Sole
79,062 Points

Hi

It is more so you can keep your CSS concise and readable, it makes easier to find things if components, for example buttons, are all grouped together in an individual file. This particularly helpful when working on large websites and in instances where someone else may have done a large portion of the work and you have now taken over.