<hr/>标签的属性及样式

本文介绍如何使用HTML中的HR标签创建多种样式的分隔线,包括基本分隔线、渐变透明效果、虚线、立体效果等,并详细解释了HR标签的各种属性及其应用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

用简单的“hr”语句就能实现多样化的分割效果:
最基本的:<hr width=300 size=1 color=#5151A2 align=center noshade>。其中 width 规定线条的长度,还可以是百分比;color 表示颜色,size 表示厚度;align 规定线条位置,有left、right、center;noshade 表示是否有立体效果。


  两头渐变透明:

<hr width=80% size=3 color=#5151A2 style="FILTER: alpha(opacity=100,finishopacity=0,style=3)">

--------------------------------------------------------------------------------


  右边渐变透明:

<hr width=80% size=3 color=#5151A2 style="FILTER: alpha(opacity=100,finishopacity=0,style=1)">

--------------------------------------------------------------------------------


  画虚线:

<hr width=80% size=1 color=#5151A2 style="border:1 dashed #5151A2">

--------------------------------------------------------------------------------


  画双线:

<hr width=80% size=3 color=#5151A2 style="border:3 double green">

--------------------------------------------------------------------------------


  立体效果:

<hr width=80% size=3 color=#5151A2 style="filter:progid:DXImageTransform.Microsoft.Shadow(color#5151A2,direction:145,strength:15)">

--------------------------------------------------------------------------------


  纺棰形:

<hr width=80% size=30 color=#5151A2 style="filter:alpha(opacity=100,finishopacity=0,style=2)">

--------------------------------------------------------------------------------


  钢针效果:

<hr width=80% size=3 color=#5151A2 style="filter:progid:DXImageTransform.Microsoft.Glow(color=#5151A2,strength=10)">

 

<hr>标签的作用是产生一线水平线

<hr>标签的属性包括

属性描述DTD
align
  • center
  • left
  • right
规定水平线的排列。TF
noshadenoshade

当设置为 true 时,水平线呈现为纯色(2D 效果)。

当设置为 false 时,水平线显示为双色凹槽(3D 效果)。

TF
size
  • pixels
  • %
规定水平线的厚度(高度)。TF
width
  • pixels
  • %
规定了水平线的宽度。TF

看下面的例子

<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">

显示结果分别为:









没有设置宽度的水平线默认为100%,所以前三条设置的对齐看不到效果

 

1、普通分隔线:<hr>

2、分隔线宽度属性:<hr width=50%> 或者 <hr width=250> (宽度为实际点数或百分比)

3、分隔线位置属性:<hr align=right width=50%> (位置分为 Left、Center、Right 三种)

4、分隔线厚度属性:<hr style="height:10px"> (奇怪,height=10 似乎不能起到效果)

5、分隔线无阴影属性:<hr style="height:10px" noshade>

6、分隔线彩色属性:<hr color=red> 或者 <hr color=#FF0000> (颜色可调)

7、渐变颜色的分隔线:
<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>

8、中心透明的分隔线:
<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>

9、中心不透明的分隔线:
<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>

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

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

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

13、竖线:
<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>
入表单、框架和表格等等,并可将之存为文本文件,浏览器即可读取和显示。HTML 指的是超文本标记语言: HyperText Markup LanguageHTML 不是一种编程语言,而是一种标记语言标记语言是一套标记标签 (markup tag)HTML 使用标记标签来描述网页HTML 文档包含了HTML 标签及文本内容HTML文档也叫做 web 页面2 入门实例新建一个test.html文件,内容如下<!DOCTYPE html><html><head><meta charset="utf-8"><title>ZONGXP</title></head><body> <h1>我的第一个标题</h1><p>我的第一个段落。</p> </body></html>其中:<!DOCTYPE html> 声明为 HTML5 文档<html> 元素是 HTML 页面的根元素<head> 元素包含了文档的元(meta)数据,如 <meta charset="utf-8"> 定义网页编码格式为 utf-8(由于在大部分浏览器中直接输出中文会出现乱码,所以要在头部将字符声明为UTF-8)<title> 元素描述了文档的标题<body> 元素包含了可见的页面内容<h1> 元素定义一个大标题<p> 元素定义一个段落保存后运行,即可在浏览器中打开如下界面3 各部分详解3.1 标题HTML 标题(Heading)是通过<h1> - <h6> 标签来定义的.<!DOCTYPE html><html><head><meta charset="utf-8"><title>ZONGXP</title></head><body> <h1>这是标题 1</h1><h2>这是标题 2</h2><h3>这是标题 3</h3><h4>这是标题 4</h4><h5>这是标题 5</h5><h6>这是标题 6</h6> </body></html>3.2 段落HTML 段落是通过标签 <p> 来定义的<!DOCTYPE html><html><head><meta charset="utf-8"><title>ZONGXP</title></head><body> <p>这是一个段落。</p><p>这是一个段落。</p><p>这是一个段落。</p> </body></html>3.3 链接HTML 链接是通过标签 <a> 来定义的<!DOCTYPE html><html><head><meta charset="utf-8"><title>ZONGXP</title></head><body> <a href="https://blog.csdn.net/zong596568821xp">这是一个链接使用了 href 属性</a> </body></html>3.4 图像HTML 图像是通过标签 <img> 来定义的。注意: 图像的名称和尺寸是以属性的形式提供的。<!DOCTYPE html><html><head><meta charset="utf-8"><title>ZONGXP</title></head><body> <img src="zongxp.jpg" width="640" height="640" /> </body></html>3.5 表格表格由 <table> 标签来定义。每个表格均有若干行(由 <tr> 标签定义),每行被分割为若干单元格(由 <td> 标签定义)。字母 td 指表格数据(table data),即数据单元格的内容。数据单元格可以包含文本、图片、列表、段落、表单、水平线、表格等等。表格的表头使用 <th> 标签进行定义。如果不定义边框属性,表格将不显示边框。有时这很有用,但是大多数时候,我们希望显示边框。使用边框属性来显示一个带有边框的表格:<table border="1"> <tr> <th>Header 1</th> <th>Header 2</th> </tr> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr></table>4 速查列表4.1 基本文档<!DOCTYPE html><html><head><title>文档标题</title></head><body>可见文本...</body></html>4.2 基本标签<h1>最大的标题</h1><h2> . . . </h2><h3> . . . </h3><h4> . . . </h4><h5> . . . </h5><h6>最小的标题</h6> <p>这是一个段落。</p><br> (换行)<hr> (水平线)<!-- 这是注释 -->4.3 文本格式化
最新发布
04-02
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值