How to set classes in HTML
Editor to share with you how to set classes in HTML, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Classifying HTML (setting classes) enables us to define CSS styles for the classes of elements.
Set the same style for the same class, or set different styles for different classes.
Example
.cities {
Background-color:black
Color:white
Margin:20px
Padding:20px
}
London
London is the capital city of England.
It is the most populous city in the United Kingdom
With a metropolitan area of over 13 million inhabitants.
Classify block-level elements
HTML elements are block-level elements. It can be used as a container for other HTML elements.
Set the class of the element so that we can set the same class for the same element:
Example
.cities {
Background-color:black
Color:white
Margin:20px
Padding:20px
}
London
London is the capital city of England.
It is the most populous city in the United Kingdom
With a metropolitan area of over 13 million inhabitants.
Paris
Paris is the capital and most populous city of France.
Tokyo
Tokyo is the capital of Japan, the center of the Greater Tokyo Area
And the most populous metropolitan area in the world.
Classify intra-line elements
The HTML element is an inline element that can be used as a container for text.
Sets the class of the element, and you can set the same style for the same element.
Example
Span.red {color:red;}
My Important Heading
These are all the contents of the article "how to set classes in HTML". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!