html分割线使用方法汇总
漫步白月光 技术交流 795阅读
hr是一个HTML标签,是标签定义HTML 页面中的主题变化,并显示为一条水平线就是分割线,hr标签是单标签没有结束标签。本文主要内容是html分割线,汇总整理了各种分割线代码。
1.基本分割线线条hr:
1、<hr>
2、align线条位置(可选left、right、center);width线条长度;color颜色;size厚度
<hr align=center width=300 color=#987cb9SIZE=1>
2.特效,效果并不是孤立的,可相互组合
1、两头渐变透明:
<hr style="FILTER:alpha(opacity=100,finishopacity=0,style=2)" width="80%"color=#987cb9 SIZE=10>
2、纺锤形:
<hr style="FILTER:alpha(opacity=100,finishopacity=0,style=1)" width="80%"color=#987cb9 SIZE=3>
3、右边渐变透明:
<hr style="FILTER:alpha(opacity=0,finishopacity=100,style=1)" width="80%"color=#987cb9 SIZE=3>
4、左边渐变透明:
<hr style="border:1 dashed #987cb9" width="80%"color=#987cb9 SIZE=1>
5、虚线:
<hr style="border:3 double #987cb9" width="80%"color=#987cb9 SIZE=3>
6、双线:
<hr style="FILTER:progid:DXImageTransform.Microsoft.Shadow(color:#987cb9,direction:145,strength:15)"width="80%" color=#987cb9 SIZE=1>
7、立体效果:
<hr style="FILTER:progid:DXImageTransform.Microsoft.Glow(color=#987cb9,strength=10)"width="80%" color=#987cb9 SIZE=1>
8、钢针效果:
<table border="1px" cellpadding="0" cellspacing="0"style="height:265px;border-left-style:solid;border-bottom-style:none;border-right-style:none;border-top-style:none">
9、垂直分割线
<table border="1px" cellpadding="0" cellspacing="0"style="height:265px;border-left-style:solid;border-bottom-style:none;border-right-style:none;border-top-style:none">
3.虚线的分割线代码
1、HTML代码:
<hr style="border: 1px dotted #FF0000; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">
2、HTML代码:
<style>hr { color:red;border:dashed;}</style><hr>
3、HTML代码:
<script>for(i=0;i<300;i++){document.write(".");}</script>
4、js代码:
<script>for(i=0;i<300;i++){document.write(".");}</script>
5、HTML代码:
<hr style="border:1px dashed #000; height:1px">
4.边框(border)的使用
同时设置上下左右边框:
border: 宽度 样式 颜色; 其中颜色可以省略(默认黑色),样式不能省略
分别设置上右下左边框(1)
border-top: 宽度 样式 颜色;(顶部) border-right:宽度 样式 颜色 ;(右边) border-bottom:宽度 样式 颜色 ;(下边) border-left: 宽度 样式 颜色;(左边)
分别设置上右下左边框(2),如果省略左则和对边(右)格式相同,如果省略下则和对边(上)格式相同,如果省略右,下,左则和 上 格式相同,
border-width:上 右 下 左; border-style: 上 右 下 左; border-color: 上 右 下 左;
分别设置上右下左边框(3)
border-top-width:2px ; border-top-style: solid; border-bottom-color:blue ;
关于样式:solid(实线),dotted(虚线)
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> .box1 { width: 200px; height: 100px; border: 3px solid red; } .box2 { width: 200px; height: 100px; border-top: 5px solid red; border-right: 5px solid red; border-bottom: 5px solid red; border-left: 5px solid red; } .box3 { width: 200px; height: 100px; border-width: 1px 2px 3px 4px; border-style: solid dotted double solid; border-color: antiquewhite aqua blueviolet chartreuse; } </style> </head> <body> <div class="box1">边框测试1</div> <div class="box2">边框测试2</div> <div class="box3">边框测试3</div> </body> </html>
标签:技术交流