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. .
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
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:
(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!