Home >Web Front-end >CSS Tutorial >How to set body font color in css

How to set body font color in css

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-06-02 14:52:575798browse

In CSS, you can use the color attribute to set the body font color. You only need to set the "color: color value" style to the body element. The color attribute specifies the color of the text. This property sets the foreground color of an element. This color is also applied to all borders of the element unless overridden by other border color properties.

How to set body font color in css

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

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

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>document</title>
  </head>
  <body>
    <p>字体颜色设置</p>
    <p>字体颜色设置</p>
    <p>字体颜色设置</p>
    <p>字体颜色设置</p>
  </body>
</html>

Here are the four paragraphs of the p tag. We should all understand it. This 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">
      body {
        color: blue;
      }
    </style>

The effect is as follows:

How to set body font color in css

# 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.

Tips and Notes

Tips: Please use a reasonable combination of background color and text color to improve the readability of the text.

How to set body font color in css

Recommended learning:

css video tutorial

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

Statement:
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