"; 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 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;}".
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:
-
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
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!