0

Im just trying to confirm if I understood @import correctly,

Basically what It can do for you probably at least one of the things is to give your css some structure by separating the different layouts in separate categories.

Right now each of my css files look insane, I have about 10 of them for one site and alot of them are using up space for the same code and only some new stuff have been added.

I am guessing that I can use @import to only add style where it is needed?

1 Answer 1

1

Yes, it works pretty much like include or require functions in PHP.

You can separate your style in multiple files and include some of them where it's needed.


Unlike PHP, CSS use HTTP requests to import files, which means your site will be slow if you separate your CSS to many files (try to keep it up to 3, but only 1 is ideal).

I suggest you to separate files only during the development period which would allow you to manage your files easier, but put everything into 1 file before launching your site.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.