Question
In the last lesson we learned about the various ways of loading CSS into an HTML document. In this exercise, why didn’t we use inline styles or the <style>
tags to load the CSS?
Answer
As developers we want to “separate our concerns” because this usually creates codebases that are more flexible, readable, and maintainable. As such, keeping our CSS contained within a separate .css file is the preferred way of including CSS within most projects.
For a deeper dive into some of the nuances here, take a look at this article.
17 Likes
There is no article linked though. Could you add it? thanks
It is best practice to keep HTML and CSS separate.
3 Likes
they added the link to the word, this
3 Likes
I wouldn’t recommend reading the article posted by @wiki-bot. It’s poorly worded and far too many syntax errors, which is very confusing, especially for beginners.
2 Likes
The linked article is pretty grim.
I found this one easier to read and understand:
Hope it helps others.
7 Likes
The inline CSS example is missing a closing
tag
The internal CSS example is missing an opening tag.
Syntax used for CSS is not what is generally displayed or written.
Thank you. I’ve also got a question:
Why the colors on CSS are not described in letters (as in blue or white), why in numbers?
For CSS colors,
you can use the word or # and then hexidecimal numbers for how much red, blue, and green
(and there are other ways to do a color in CSS too).
I see; the numbers help specify how rich or light the color will be. Thank you!
Thank for the answer, really clarifies the point. Cheers