I was doing the Desmoto’s Arts & Crafts project for HTML/CSS and found something that is not clear.
In the first section, we have to format the heading and its background.
In HTML I wrote the following (Only including the relevant part:
<div class="maro"> <h1>Dasmoto's Arts & Crafts</h1> </div>
In CSS I decided to format in the following way:
In this case, the font-size is way out of proportion and is not anything like on the given task. However, the moment I change “.maro” to “.maro h1”, everything is correct and it falls in the right way.
I don’t understand why we need to specify this if div and class functions are used to generalize the rule in a way that everything is affected withing the class range, excluding things that are more specified.
I understand that I could’ve specified the class in “h1” itself but should it matter when there’s only one attribute in the “div” tag?
Thank you in advance for the help!