Home  >  Article  >  Web Front-end  >  How to set the length of hr in css

How to set the length of hr in css

青灯夜游
青灯夜游Original
2021-11-10 16:23:508274browse

In CSS, you can use the width attribute to set the length of the hr horizontal line. You only need to add the "hr{width: width value;}" style to the hr element; the width value can be in pixels or percentages.

How to set the length of hr in css

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


tag creates a horizontal line in an HTML page.

Horizontal rule (horizontal rule) can visually separate the document into various parts.

The default length (width) of the hr horizontal line is the width of the browser window, which will change as the width of the window changes.

How to set the length of hr in css

But, you can also set it yourself!

We can use the css width attribute to change the length (width) of the hr horizontal line. The width attribute specifies the width of the horizontal line, in pixels or as a percentage.

hr{
	width: 100px;
}

How to set the length of hr in css

(Learning video sharing: css video tutorial

The above is the detailed content of How to set the length of hr 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