Home  >  Article  >  Web Front-end  >  How to change the color of hr tag in css

How to change the color of hr tag in css

王林
王林Original
2020-11-11 10:03:559043browse

How to change the color of the hr tag in css: You can use the background-color attribute and combine it with the border and height attributes. The border attribute is to prevent the black box from appearing, and the height attribute is to prevent it from not being displayed under Firefox.

How to change the color of hr tag in css

First of all, we need to know that if we want to modify the color of the hr tag, we cannot do it simply by using the background-color attribute.

(Learning video sharing: java video tutorial)

The method is as follows:

hr{
    border: none;
	height: 1px;
	background-color: #e5e5e5;
}

Analysis:

border: none; or border: 0; is to prevent a black box from appearing

height: 1px; is to prevent it from not being displayed under firefox

background-color: #e5e5e5; is to fill in the color you need to change

Related recommendations: CSS tutorial

The above is the detailed content of How to change the color of hr tag 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