style="border-bottom:1px
dotted
#ccc">文字内容</td>
<td
style="border(边框)-bottom(底部):1px(1像素)
dotted
(虚线)#ccc(颜色)">文字内容</td>
上面这句话的意思是:在这个td里面的样式为
底部边框为1像素颜色为#ccc的虚线
dotted
是虚线
solid
是实线
可以用CSS样式和HTML标签元素实现,我们选择几个常用标签对齐设置边框虚线效果:
1、html常用标签:
p标签
span
ul li
table tr td
2、实例用到CSS属性单词:
border
width
height
3、实现虚线的CSS重点介绍:
border为边框属性,如果要实现对象边框效果,要设置边框宽度、边框颜色、边框样式(实线还是虚线):
border:1px dashed #F00 这个就是设置边框样式宽度为1px,虚线,虚线为红色。
4、实例描述:
我们对以上几个标签设置相同宽度、相同高度、边框效果。
5、完整HTML代码:
<!DOCTYPE html><html>
<head>
<meta charset="utf-8" />
<title>html边框虚线演示</title>
<style> .bor{border:1px dashed #F00width:300pxheight:60pxmargin-top:10px} span{display:block}/*css注释说明:让span形成块*/
</style>
</head>
<body>
<p class="bor">p盒子</p>
<span class="bor">span盒子</span>
<ul class="bor">
<li>ul li列表</li>
<li>ul li列表</li>
</ul> <table class="bor">
<tr>
<td>表格</td>
<td>表格2</td>
</tr>
<tr>
<td>数据</td>
<td>数据2</td>
</tr>
</table>
</body>
</html>
效果图:
<!DOCTYPE HTML><html>
<meta charset="UTF-8" />
<head>
<title></title>
</head>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<style type="text/css">
*{
margin: 0
padding: 0
}
.box {width: 100%border: 1px solid #000000box-sizing: border-boxposition: relative}
.img1{height: 100%width: 100%}
li{list-style: none}
.box li{border-bottom: 1px dashed #000000width: 80%background: #DCDCDCheight: 35px}/*dashed是虚线width控制li的宽度*/
.text{position: absolutetop:42.5pxleft:30%}
.text20{position: absolutetop:42.5pxright:20px}
</style>
<body>
<div class="demo">
<div class="box" style="">
<ul>
<li>内容1</li>
<li>内容2</li>
<li>内容3</li>
</ul>
<div class="text">
灰色内容占总宽度80%
</div>
<div class="text20">
白色内容占</br>总宽度20%
</div>
</div>
</div>
</body>
</html>