Joke Collection Website - Cold jokes - What does the class in css mean!

What does the class in css mean!

Class is a class selector that allows you to specify styles independently of document elements.

Before using the class selector, you need to modify specific document tags so that the class selector can work properly.

In order to associate the style of a class selector with an element, you must specify class as an appropriate value. Please look at the following HTML code:

& lth 1 class="important "> This title is very important. & lt/h 1 & gt; & ltp class="important "> This paragraph is very important. & lt/p & gt;

In the above code, the classes of two elements are designated as important: the first title (element h 1) and the second paragraph (element P).

Extended data

Class values contain words. In HTML, a class value may contain a list of words separated by spaces.

For example, if you want to mark a specific element as both important and warning, you can write: < p class="important warning "> This paragraph is a very important warning. & lt/p & gt; The order of these two words is not important. It can be written as a warning of importance.

Assume that all elements with class important are bold, all elements with class warning are italicized, and all elements with both important and warning have a silver background.

You can write:. Important {font-weight: bold; }. Warning {font-weight: italic; } .important.warning {background: silver; } By linking two class selectors together, only elements containing these class names can be selected (the order of class names is not limited).

Baidu encyclopedia-category selector