How to change text color with css

王林
Release: 2023-01-06 11:13:18
Original
10728 people have browsed it

The way to change the text color in css is to set the color attribute, such as [color:red;] or [color:#00ff00;], which means setting the text to red.

How to change text color with css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

It is actually very simple to change the color of text in CSS. You only need to add the Color attribute, which can specify the color of the text.

We can set the color in the following ways.

Color name: Color name, such as red, blue, brown, lightseagreen, etc., is not case-sensitive.

HEX: Hexadecimal symbols #RRGGBB and #RGB (e.g. #ff0000). "#" followed by 6 or 3 hexadecimal characters (0-9, A-F).

RGB, red-green-blue (RGB): The color value is specified as the color of the rgb code. The function format is rgb(R,G,B), and the value can be 0 -255 as an integer or percentage.

For example:

      

这是标题 1

这是一个普通的段落。请注意,本文是红色的。页面中定义默认的文本颜色选择器。

这是一个类为"ex"的段落。这个文本是蓝色的。

Copy after login

Let’s take a look at the running effect:

How to change text color with css

Related learning video sharing:css video tutorial

The above is the detailed content of How to change text color with 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!