Difference between revisions of "CS49"
From Coder Merlin
(Created page with "== HTML Class Attribute == === Formatting the class attribute === The tag .class is often used to attribute specific formatting styles (font, color, size, etc.) to multiple elements under that class. === Example: === .city { background-color: tomato; color: white; margin: 20px; padding: 20px; } In the above example, the class is named "city" and has specific formatting styles attached to it. To apply the class to multiple elements, you would use this sy...") |
|||
Line 29: | Line 29: | ||
As you can see, the tag <div class="city"> will apply the formatting styles defined under the class ".city" to the heading tags that say London, Paris, and Tokyo. | As you can see, the tag <div class="city"> will apply the formatting styles defined under the class ".city" to the heading tags that say London, Paris, and Tokyo. | ||
=== Purpose === | === Purpose === | ||
The purpose of the HTML class attribute is to keep your code short and neat and to save time. | The purpose of the HTML class attribute is to keep your code short and neat and to save time. |
Revision as of 11:53, 23 January 2023
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
HTML Class Attribute[edit]
Formatting the class attribute[edit]
The tag .class is often used to attribute specific formatting styles (font, color, size, etc.) to multiple elements under that class.
Example:[edit]
.city { background-color: tomato; color: white; margin: 20px; padding: 20px; }
In the above example, the class is named "city" and has specific formatting styles attached to it. To apply the class to multiple elements, you would use this syntax:
London
Paris
Tokyo
As you can see, the tag
will apply the formatting styles defined under the class ".city" to the heading tags that say London, Paris, and Tokyo.
Purpose[edit]
The purpose of the HTML class attribute is to keep your code short and neat and to save time.