the first problem I am facing is this: why do I need to master HTML first, then CSS? For example, I make a heading and then apply changes to it daily, like changing the background color or text color. I have to switch for every tag rather than doing it one time between languages.
Why is it like this? Why do I have to learn the whole structure in general (HTML) and then its styling (CSS) for making a website or a project?
It is clear that I have to make a heading or paragraph first, then I will style it. But for general learning, there are many courses that say “Learn full or advanced HTML” and then CSS. This thing confuses me daily while learning.
Top comments (1)
Content is king. Your users come to your website for the information it provides, not because it is beautiful. If you markup your content correctly, then all users will be able to interact with that information regardless of the technology they use to visit it.
Knowledge builds on knowledge. You learn to count before you learn arithmetic. You learn arithmetic before you learn algebra. By fully understanding the semantics of HTML's elements, you gain insights into why CSS is organized the way it is. For example, understanding why and where id attributes are used informs why ids have a higher specificity than classes. Or knowing where p and strong elements are used gives you the basics of the concepts of block-level and inline-level boxes.
Learning HTML is relatively speaking easy to learn. There are only 113 different regular HTML elements and less than 200 attributes. The relationships between them are mostly simple and new additions are rare. In contrast, there's almost 1000 regular CSS properties, new ones are frequently added and how they interact with each other can be both complex and subtle.
Do you have to learn HTML thoroughly before learning CSS? No. I didn't, and neither do most self-taught web devs. The desire to want to style your paragraph as soon as you create it is very strong, and the reward of the "quick win" in helping build confidence in what you're doing should not be underestimated. But, with hindsight, I wish I had spent more time early on getting to know HTML better. I think I would have understood the intricacies of CSS much more quickly had I done so,