"; 2. Add it in the style tag, and the syntax style is " h1{background:white;}"."/> "; 2. Add it in the style tag, and the syntax style is " h1{background:white;}".">

Home  >  Article  >  Web Front-end  >  How to set the first-level title background in html

How to set the first-level title background in html

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-06-02 16:36:224715browse

How to set the background of the first-level title: 1. Set it in the first-level title tag, and the syntax style is "

"; 2. Add it in the style tag, and the syntax style is "h1{background:white;}".

How to set the first-level title background in html

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

Generally use CSS styles to set

background is used to set the background color

<h1 style="color:red;font-size:20px;background-color:black"></h1>

or

 <style>
      h1 {
        color: red;
        font-size: 16px;
        background-color: white;
      }
    </style>

Extension:

-

tags define titles.

defines the largest heading.

Defines the smallest heading.

Because the h element has exact semantics, please carefully choose the appropriate tag level to structure the document. Therefore, please do not use title tags to change the font size within the same line. Instead, we should use cascading style sheet definitions to achieve beautiful display effects.

Background shorthand property sets all background properties in one declaration.

You can set the following properties:

  • background-color

  • ##background-position

  • background-size

  • background-repeat

  • background-origin

  • background- clip

  • background-attachment

  • background-image

If one of them is not set value, there will be no problem. For example, background:#ff0000 url('smiley.gif'); is also allowed.

It is generally recommended to use this attribute instead of using individual attributes separately, because this attribute is better supported in older browsers and requires fewer letters to be typed.

How to set the first-level title background in html

Recommended learning:

html video tutorial

The above is the detailed content of How to set the first-level title background in html. 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