How to set font color in css

藏色散人
Release: 2023-01-05 16:11:07
Original
4206 people have browsed it

How to set the font color in css: first create an HTML sample file; then define some text content in the body; finally set the font color through the "p{color:blue}" attribute.

How to set font color in css

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

How to set font color in css?

In html, we often use css styles to beautify some shortcomings of html tags. Today we will talk about how to use the basic styles of css to change the color of text. The article is easy to understand. I hope After reading it, everyone can practice to deepen their impression.

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

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

How to set font color in css

Here are the four paragraphs of the p tag, which we should all be able to understand. , which is the simplest code style.

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 font color in css

##color Property 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 font color in css. 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