Well I don’t believe this a good practice at all! Why do you think imports are messy?
IMO it is really better to link to the css files from the HTML page!
It can be messy trying to fitgure out what styles come from where and if you have selectors of the same specificity that match, it can be confusing to figure out which wi9ll take presedence
Well I don’t believe this a good practice at all! Why do you think imports are messy?
IMO it is really better to link to the css files from the HTML page!
There’s a place for imports. Esp when there are a basic set of styles all pages share and then other styles that are much to different to go around undoing and overriding them. At least, that was the reason I needed to use @import once. The other option was having the special pages repeat a lot of CSS.
Well actually I don’t have a lot to import. I just have a main (stylesheet.css) and want to create another (customized.css) which overwrites some of the ones declared in the main.
I thought I might as well import customized.css at the bottom of main (since its over writting the main). But I’m not sure if its CSS specificity at work, it doesn’t seem to import.
I tried shifting the import statement to the start of the main stylesheet, and it does import.
Weird…does import have to be at the start? And, any tips on how to handle CSS specificity? Some times, I just couldn’t get the CSS overwrite to work properly.
Just remember that whatever selectors you have (with the same specificity and targets the same element(s)) will always look to see which came later in the CSS.