Best practice question


#1

https://www.codecademy.com/courses/learn-html-css/lessons/css-fonts/exercises/more-fonts?action=lesson_resume&link_content_target=interstitial_lesson

The code in this exercise is fine. I just want to know what best practice is regarding the placement of links in the html code. The exercise asks us to insert the link to several fonts in the index.html code via GoogleFonts, but I haven’t seen any info regarding where, within the head, to include it. For example, should most current code added go toward the bottom, within the head, or should all like-code be kept together in the same grouping (ie, font code adjacent to other font code, when applicable)? It may not matter, but I would like to adhere to best practice whenever possible. Thanks in advance for the help/info!

```

#2

Order does matter when loading style sheets. Think of what must be present in order for our custom styles to work? Do we load the fonts before or after that style sheet? Answer: Definitely before.

fonts
css
script

in that order. It makes sense that fonts would load first since our CSS depends upon them being present when drawing the page. Script, which is not mentioned until later, so pay it no mind, just now, may be modifying the DOM so depends on the target elements being present.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.