In this video, you switched the long class off and on in the Elements panel and watched Priya’s page follow, without changing the stylesheet.
Key Points
- One rule,
#games li.long, styles whichever game in the games list carries the classlong. It never names a game. - When you type the class, write the bare name,
class="long". The dot belongs only to the selector,.long, where it says thatlongis a class. - To switch the class off in the Elements panel, double-click its value in the tree, delete it, and press Enter. Catan turns gray and loses its bold: the
#games lirule still matches it, and the#games li.longrule drops out of the Styles pane. - To switch it back on, right-click Catan’s row in the Elements panel, choose Add attribute, type
class="long", and press Enter. Any game can carry the class: do the same on the Codenames row, and Codenames turns the accent color and bold too. - A class used like this is a state class: it names a state an element can be in, and the stylesheet says once how that state looks. To change how one element looks as its state changes, switch its class. The stylesheet already says how each state looks.
- Edits in the Elements panel only last in that tab until it reloads. The browser then reads your file again. Later on, a script will do the switching: each time the page loads, it reads the game data and puts
longon every game over an hour.
The Final Code
Nothing in the files changed in this video. The games list in scratch/index.html: