.Description vs. Main - Which to Choose?


#1

In Learn CSS: Selectors and Visual Rules, it says to write a CSS selector for the .description class. But the hint tells you how to select a class named “main” (without quotes). I’m confused: wouldn’t the solution to this task be to include .description somewhere? We didn’t really learn a lot about “main”.


#2

When written like this,

main {
    /* some properties */
}

the above is a type selector, targeting the <main></main> element, assuming one exists.

When written like this,

.description {
    /* some properties */
}

the above is a class selector targeting all elements bearing the class="description" attribute.


#3

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