This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Make a Website: Bootstrap Forum

View Course » View Exercise

633 points
7e3cbbc4fdbbeba90a66e19b5fa2633a?s=140&d=retro
Submitted by
atrim
over 2 years ago

What's the difference in the order of the first two .css files?

Expected order according the instructions is (shift.css, bootstrap.css, main.css).
I tried to interchange the positions of the css files to check out what happens. I see a difference when i change the position of the main.css file. But the change is only that the color of the h1 text changes to black/dark grey from white, and when introduced before the shift.css or bootstrap.css files(so when main.css is not the last one).

When the order is (bootstrap.css, shift.css, main.css), there is no difference to the output of the expected order. Why might this be? Is it because of some settings of my browser or the specific font that is being used?


0 votes

permalink

I'm not an expert on this, but I do know that as you add a .css file to the bottom of the list and it contains any selectors that are also contained in any previous .css files, the new file will override all of the previous rules for that selector. In your case the h1 selector must be in both bootstrap.css and main.css.

The part I'm not sure on is the explanation in exercise 2/14 about putting shift.css before bootstrap.css so that the shift font will be available. You aren't the first to point out that they can't see a difference when they reverse the order of those two files. Maybe it depends on the browser or page size, maybe performance or page loading time -- I don't know. Maybe someone who knows more about about that will comment.

3691 points
55df2afa95e3787b9200005e_359368177
Submitted by
Judy
over 2 years ago

3 Comments

7e3cbbc4fdbbeba90a66e19b5fa2633a?s=140&d=retro atrim over 2 years ago

I got the "new file will override all of the previous rules for that selector" but since I didnt see a change, I was getting uneased. Apologies for not checking other posts, guess I should have! Thanks! :)

55df2afa95e3787b9200005e_359368177 Judy over 2 years ago

Hi Atrim, sorry, I didn't mean that you should have checked other posts, it's not that easy a thing to do here :)

Be05bfbde0ac086956056bb007f37985?s=140&d=retro petminded over 2 years ago

Do have an answer to this or a link to another post?