Hanoi is the capital of Vietnam.
Paris is the capital of France.
Tokyo is the capital of Japan.
The results displayed will look like the following.
The class attribute applies to many elements
Note:
class
properties can be used with any HTML element.Use class properties in JavaScript
JavaScript can access certain class-named elements with getElementsByClassName()
For example, when a user clicks a button, hiding all elements with the class name is 'city'.
Use multiple layers in HTML
HTML elements can use multiple class names, each with a space separated by a space. For example, you can style elements with the 'city' and 'big' layers.
Same class but different cards
Different cards like
good
can use the same class name (and have the same style).
Hanoi is the capital of Vietnam.
Previous lesson: Block and inline elements in HTML
The following article: id attribute in HTML