Question about Task 7 of CSS Recipe Project

Hi, I have question about Task 7 of the Recipe Project for CSS

This what they ask:

Finally, let’s make the font Helvetica instead of the default Times New Roman. Instead of writing multiple selectors to apply the font-family property, write a selector that applies a font-family attribute to all text at once.

The selector should target the h1, h2, p, and li elements.

To change their font, include this line of code inside the curly braces:

font-family: Helvetica;

This is what I wrote:

h1,h2,p,li {
font-family: Helvetica;

My question is can I use *{} instead of listing all those elements?


The universal selector is practical, but ubiquitous, and we don’t always know how much it will affect if used at the wrong time. It could make our entire stylesheet go wonky, as a worst case.

The only place to apply this selector is at the very beginning of the cascade, and never later. Decide which rule you wish to impose, impose it, and then let the style sheet build up from that.

Thing to stay away from is thinking that a stylesheet is a program. It is not. It is a collection of selector rulesets with precedence ordered by the cascade. This in itself has no bearing on the content to which these rules are applied. It is the elements that will match up with these rules that will be affected. There is no order in that, only coincidence, albeit declarative.

Yes, there is logic in all this, but it is the author’s logic, not a program. The program that is running in the background is merely carrying out the author’s wishes.

1 Like

Ok thank you for the help!


1 Like