Home Web Front-end HTML Tutorial What are the attributes of html hr tag? Detailed explanation of the style of HTML hr tag

What are the attributes of html hr tag? Detailed explanation of the style of HTML hr tag

Aug 18, 2018 pm 01:30 PM
hr html

html What are the attributes of the hr tag? Detailed explanation of the style of HTML hr tag. This article introduces the definition and attribute description of hr tag in html, as well as several methods of using the style of html hr tag

hr tag in html Definition and Usage: The


tag creates a horizontal line in an HTML page.

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

HTML


tag example:

Titles and paragraphs separated by horizontal lines:

<h1>This is header 1</h1>
<hr />
<p>This is some text</p>

Optional attributes of the hr tag in html:

What are the attributes of html hr tag? Detailed explanation of the style of HTML hr tag

How to use the hr tag in web pages:

<hr align="center">
<hr align="left">
<hr align="right">
<hr noshade="true">
<hr noshade="false">
<hr size="5">
<hr width="500px">
<hr align="left" noshade="false" size="4" width="500px" color="#ff0000">

How to use the hr tag in various styles :

The various styles of hr in web design, if used properly, will add a lot of color to your page. Here is a detailed introduction to the various styles and various usage methods!

The editor I use is eclipse. This is based on personal preference. It doesn’t matter what you use. Even if you use txt directly, you can still achieve the effect here. After all, it is just static.

The first type:

<hr style=" height:2px;border:none;border-top:2px dotted #185598;" />

height:2px; is the height of hr

border:none; is no border

border-top:2px dotted #185598; is to set the style of the horizontal line

dotted dashed line #185598 color

Second:

<hr style="height:1px;border:none;border-top:1px dashed #0066CC;" />

Third:

<hr style="height:1px;border:none;border-top:1px solid #555555;" />

Fourth Type:

<hr style="height:3px;border:none;border-top:3px double red;" />

Use various styles of hr in html

Fifth type:

<hr style="height:5px;border:none;border-top:5px ridge green;" />

Sixth type:

<hr style="height:10px;border:none;border-top:10px groove skyblue;" />
border-top:10px groove skyblue;    groove  上颜色        skyblue   下颜色

Gradient color separator :

<hr style="filter:alpha(opacity=5,finishopacity=100,style=1);height:10px" color=green>
<hr style="filter:alpha(opacity=100,finishopacity=5,style=1);height:10px" color=blue>

Transparent dividing line in the center:

<hr style="filter:alpha(opacity=0,finishopacity=100,style=2);height:12px" color=orange>
<hr style="filter:alpha(opacity=0,finishopacity=100,style=3);height:12px" color=#FF00FF>

Opaque dividing line in the center:

<hr style="filter:alpha(opacity=100,finishopacity=0,style=2);height:15px" color=yellow>
<hr style="filter:alpha(opacity=100,finishopacity=0,style=3);height:15px" color=#00FFFF>

Wavy line:

<hr style="filter:wave(strength=9,freq=2,lightstrength=20,phase=9);height:15px" color=pink width=95%>

Three-color line:

<hr style="border-top: #ff0000 solid; color: #00ff00; border-bottom: #0000ff solid; height: 9px">

Dotted line:

<hr style="border-top: 2px dashed; border-bottom: 2px dashed; height: 2px" color=black>

Vertical line:

<hr style="height:100px; width:4px" color=orange>
<hr style="filter:alpha(opacity=100,finishopacity=5,style=2); height:100px; width:5px" color=navy>
<hr style="filter:alpha(opacity=0,finishopacity=100,style=2);height:100px; width:4px" color=red>

Difference between HTML and XHTML

In HTML, the


tag does not End tag.

In XHTML,


must be closed correctly, such as
.

In HTML 4.01, all rendering attributes of the hr element are deprecated.

In XHTML 1.0 Strict DTD, all rendering attributes of the hr element are not supported.

[Related recommendations]

html What is the role of the title tag? A detailed introduction to the html title tag

#Do you know how to use the html select tag? Introduction to html select tag attributes


The above is the detailed content of What are the attributes of html hr tag? Detailed explanation of the style of HTML hr tag. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1582
276
How to add an icon to your website title tab in HTML How to add an icon to your website title tab in HTML Aug 07, 2025 pm 11:30 PM

To add an icon to the website title bar, you need to link a favicon file in part of the HTML. The specific steps are as follows: 1. Prepare a 16x16 or 32x32 pixel icon file. It is recommended to use favicon.ico to name it and place it in the website root directory, or use modern formats such as PNG and SVG; 2. Add link tags to HTML, such as PNG or SVG formats, adjust the type attribute accordingly; 3. Optionally add high-resolution icons for mobile devices, such as AppleTouchIcon, and specify different sizes through the sizes attribute; 4. Follow best practices, place the icon in the root directory to ensure automatic detection, clear the browser cache after update, and check the correctness of the file path.

How to add an icon to a button in HTML How to add an icon to a button in HTML Aug 07, 2025 pm 11:09 PM

Using FontAwesome can quickly add icons by introducing CDN and adding icon classes to buttons, such as Like; 2. Using labels to embed custom icons in buttons, the correct path and size must be specified; 3. Embed SVG code directly to achieve high-resolution icons and keep them consistent with the text color; 4. Spacing should be added through CSS and aria-label should be added to the icon buttons to improve accessibility; in summary, FontAwesome is most suitable for standard icons, pictures are suitable for custom designs, while SVG provides the best scaling and control, and methods should be selected according to project needs. FontAwesome is usually recommended.

Why is my HTML image not showing up? Why is my HTML image not showing up? Aug 16, 2025 am 10:08 AM

First, check whether the src attribute path is correct, and ensure that the relative or absolute path matches the HTML file location; 2. Verify whether the file name and extension are spelled correctly and case-sensitive; 3. Confirm that the image file actually exists in the specified directory; 4. Use appropriate alt attributes and ensure that the image format is .jpg, .png, .gif or .webp widely supported by the browser; 5. Troubleshoot browser cache issues, try to force refresh or directly access the image URL; 6. Check server permission settings to ensure that the file can be read and not blocked; 7. Verify that the img tag syntax is correct, including the correct quotes and attribute order, and finally troubleshoot 404 errors or syntax problems through the browser developer tool to ensure that the image is displayed normally.

How to use del and ins tags in HTML How to use del and ins tags in HTML Aug 12, 2025 am 11:38 AM

Thetagisusedtomarkdeletedtext,optionallywithdatetimeandciteattributestospecifywhenandwhythedeletionoccurred.2.Thetagindicatesinsertedcontent,alsosupportingdatetimeandciteforcontextabouttheaddition.3.Thesetagscanbecombinedtoshowdocumentrevisionsclearl

How can you make an HTML element editable by the user? How can you make an HTML element editable by the user? Aug 11, 2025 pm 05:23 PM

Yes, you can make HTML elements editable by using the contenteditable attribute. The specific method is to add contenteditable="true" to the target element. For example, you can edit this text, and the user can directly click and modify the content. This attribute is suitable for block-level and in-line elements such as div, p, span, h1 to h6. The default value is "true" to be editable, "false" to be non-editable, and "inherit" to inherit the parent element settings. In order to improve accessibility, it is recommended to add tabindex="0&quo

How to set a default value for an HTML select element How to set a default value for an HTML select element Aug 17, 2025 pm 01:00 PM

To set the default value for HTMLselect elements, the corresponding option element must be marked with the selected attribute; 1. Add the selected attribute to the option you want to select by default, such as UnitedStates; 2. Ensure that only one option in a single select has selected attribute, and if there are multiple ones, the first one will be the source code order; 3. The selected attribute can be placed anywhere in the list, not limited to the first option; 4. This method is suitable for single-select and multiple-select select; 5. If you need to set it dynamically, you can use JavaScript to operate the value attribute, such as document.querySelec

How to use the async attribute for script loading in HTML How to use the async attribute for script loading in HTML Aug 17, 2025 pm 12:52 PM

TheasyncattributeinHTMLisusedtoloadandexecuteexternalJavaScriptfilesasynchronously,allowingthebrowsertodownloadthescriptinparallelwithHTMLparsingandexecuteitimmediatelyuponcompletion,whichimprovespageloadperformancebypreventingrender-blocking;itisbes

How to use the bdo tag to override text direction in HTML How to use the bdo tag to override text direction in HTML Aug 16, 2025 am 09:32 AM

Thebdotagisusedtooverridethebrowser’sdefaulttextdirectionrenderingwhendealingwithmixedleft-to-rightandright-to-lefttext,ensuringcorrectvisualdisplaybyforcingaspecificdirectionusingthedirattributewithvalues"ltr"or"rtl",asdemonstrat

See all articles