How to call class in css

WBOY
Release: 2021-11-25 17:29:09
Original
6898 people have browsed it

In CSS, you can use the ".class" selector to call class. This selector is used to select elements with specified class attributes. The syntax is ".class attribute value {css style code;}".

How to call class in css

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to call class in css

#When we usually create web pages, we often use class to select and call CSS style attributes. Newbies who are learning CSS are not very familiar with the use of classes. Let’s briefly introduce it below.

Class is called "class" in the program, and it is also called "class" in written language in CSS. In the CSS style, use lowercase "dot" and "." to name it such as: .top{attribute: attribute value;}.

That is, the "." class selector selects elements with the specified class (class).

In the html page, use class="top" to select the call, such as: .top{attribute: attribute value;}, in the html page, call it as

Here is The text

example is as follows:

<!DOCTYPE html>
<html>
<head>
<style>
.intro
{
background-color:yellow;
}
</style>
</head>
<body>
<h1>欢迎来到我到的主页</h1>
<div class="intro">
<p>我是唐老鸭。</p>
<p>我住在 Duckburg。</p>
</div>
<p>我最好的朋友是米老鼠。</p>
</body>
</html>
Copy after login

Output result:

How to call class in css

It can be seen that through ".class" selection The processor can call the specified class to execute the specified css style.

Note:

These are the simplest css, I hope it will be helpful to beginners.

(Learning video sharing: css video tutorial)

The above is the detailed content of How to call class in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template