What is the purpose of a class in css?

1 answer

Answer

1027660

2026-05-15 01:30

+ Follow

A CSS class is a line of code in your CSS file which corresponds to the HTML equivalent of that class; it is defined with a dot: "."

<div class="test">This is a test.</div>

CSS:

.test { display: block; background: #f90; color: #fff; }

The classes are used to define the style for the individual element of the web page or to determine different styles for the one tag. Syntax for the classes will be the following:

Tag.Name of class { property1: value; property2: value; ... }

Inside of the style sheet the desirable tag is written first, than, after the semicolon - the user's class name. In order to define in HTML code the fact, that tag with the definite style is used, parameter is added to the tag

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.