Home > Web Front-end > Front-end Q&A > How to set css font color

How to set css font color

藏色散人
Release: 2023-01-03 09:27:59
Original
8319 people have browsed it

How to set css font color: First create an HTML sample file; then define some p tags in the body and enter text content in the p tags; finally add the css style to the p tags as "p{color: blue }" to modify the font color.

How to set css font color

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

1. First, let’s show you the basic code of the html font:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP中文网</title>
</head>
<body>
<p>字体颜色设置</p>
<p>字体颜色设置</p>
<p>字体颜色设置</p>
<p>字体颜色设置</p>
</body>
</html>
Copy after login

How to set css font color

Here are the four paragraphs of the p tag, we should be able to do it Understand, this is the simplest code style.

2. Next we need to set the html font color. Let’s take a look at the css style code:

<style type="text/css">
p{color: blue}
</style>
Copy after login

The effect is as follows:

How to set css font color

## The #color attribute specifies the color of the text.

This attribute sets the foreground color of an element (in HTML representation, the color of the element's text); raster images are not affected by color. This color also applies to all borders of the element, unless overridden by border-color or another border-color property.

To set the foreground color of an element, the easiest way is to use the color attribute.

【Recommended learning:

css video tutorial

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

Related labels:
css
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