HTML 水平线
2025-04-23
24
参考资料
HTML水平线(Horizontal Rule)用于在网页中创建一条水平分隔线。
标签:<hr>
用法:
基本用法:
<hr>
带属性的传统用法(HTML4):
<hr width="50%" size="3" noshade color="red">
功能:
内容分隔
视觉分区
文档结构划分
CSS扩展:
hr { height: 2px; background-color: #ccc; border: none; margin: 20px 0; } /* 渐变效果 */ hr.gradient { height: 3px; background: linear-gradient(to right, red, yellow); } /* 虚线样式 */ hr.dashed { border-top: 1px dashed #999; } /* 阴影效果 */ hr.shadow { box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
HTML5特性:
语义化标签,表示主题分隔
不再推荐使用传统属性(width/size/color等)
建议完全通过CSS控制样式
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。