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

How to set the width of hr in css

青灯夜游
青灯夜游Original
2021-11-02 15:45:184116browse

In CSS, you can use the width attribute to set the width of hr. The function of this attribute is to set the width of the element. You only need to set the "hr{width: width value unit;}" style for the hr element. .

How to set the width of hr in css

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

In HTML<hr> tag sets the width of the horizontal line. The default is to fill the full screen

How to set the width of hr in css

Sometimes we don’t need to The hr width takes up the entire screen. How do we modify the hr width? We can use the css width property to set the width of hr.

The width attribute sets the width of the element. This attribute defines the width of the element's content area, and padding, borders, and margins can be added outside the content area.

Example:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
hr{
width: 100px;
}
</style>
</head>
<body>
<hr />
</body>
</html>

Rendering:

How to set the width of hr in css

(Learning video sharing: css video tutorial )

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