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

How to set the first-level title background in html

醉折花枝作酒筹
Release: 2023-01-06 11:16:11
Original
4783 people have browsed it

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>
Copy after login

or

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

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!

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template