1
I am a student of Information Systems and I am putting together an HTML/CSS training for my junior company, and during this assembly came to me a question, what is the most effective way to organize CSS files?
In my view, there are 3 ways to organize your CSS:
First way: Use a global style
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
With CSS similar to:
.classe-arquivo1{
/* css */
}
.classe-arquivo2{
/* css */
}
.classe-arquivo3{
/* css */
}
Second way: Link all required CSS files
<head>
<link rel="stylesheet" type="text/css" href="arquivo1.css">
<link rel="stylesheet" type="text/css" href="arquivo2.css">
<link rel="stylesheet" type="text/css" href="arquivo3.css">
</head>
Each file with its respective CSS
Third way: A global file with changes that repeat on all pages, using import to link other files
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
With CSS similar to:
@import url("arquivo1.css");
@import url("arquivo2.css");
@import url("arquivo3.css");
.classe-global{
/* css */
}
That being said, my question is: What is the fastest way? And if there is no faster way, in which situations I use each way quoted above?
This is my first question here at Stackoverflow, I don’t know if I asked the question correctly, but thanks in advance!
What parameters should be analysed to define a better?
– Woss
Performance @Andersoncarloswoss
– Brito
Consider minifying the files, so you only have 1 css with everything. And organize everything with SASS. Study SASS :)
– Hiago Souza
Exact using the Concat+Sass vc can minify all css to a single file
– wDrik