Knowledge in HTML The class Attribute

HTML The class Attribute

Using The class Attribute The HTML class attribute is used to define equal styles for elements with the same class name. So, all HTML elements with the same class attribute will get the same style. Here we have three elements that point to the same class name: Example .cities { background-color: black; color: white; margin: 20px; padding: 20px; } London London is the capital of England. Paris Paris is the capital of France. Tokyo Tokyo is the capital of Japan.