使用CSS实现圆角Div(无图片)
2015-06-02 09:13
851 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
body{ margin:0; padding:20px; font-size:12px; line-height:1.8em; }
#nifty{ background: #014477;}
#nifty span{ padding:20px; color:#FFF; display:block;}
.rtop, .rbottom{ display:block; background:#FFF}
.rtop div, .rbottom div{ display:block; height:1px; overflow:hidden; background: #014477}
.r1{margin: 0 7px}
.r2{margin: 0 5px}
.r3{margin: 0 3px}
.r4{margin: 0 2px}
.rtop .r5, .rbottom .r5{margin: 0 1px;height: 2px}
</style>
<title>圆角边框</title>
</head>
<body>
<div id="nifty">
<div class="rtop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div><div class="r5"></div></div>
<span class="text">第三种方法不用到图片,原理是通过div的嵌套和div设置的margin值的递增来实现圆角 </span>
<div class="rbottom"><div class="r5"></div><div class="r4"></div><div class="r3"></div><div class="r2"></div><div class="r1"></div></div>
</div>
<p>这个圆角框可以自由伸展,四个方向都能自适应,而且,不用图片</p>
<p><a href="http://www.zknight.net">返回骑士的博客</a></p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
body{ margin:0; padding:20px; font-size:12px; line-height:1.8em; }
#nifty{ background: #014477;}
#nifty span{ padding:20px; color:#FFF; display:block;}
.rtop, .rbottom{ display:block; background:#FFF}
.rtop div, .rbottom div{ display:block; height:1px; overflow:hidden; background: #014477}
.r1{margin: 0 7px}
.r2{margin: 0 5px}
.r3{margin: 0 3px}
.r4{margin: 0 2px}
.rtop .r5, .rbottom .r5{margin: 0 1px;height: 2px}
</style>
<title>圆角边框</title>
</head>
<body>
<div id="nifty">
<div class="rtop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div><div class="r5"></div></div>
<span class="text">第三种方法不用到图片,原理是通过div的嵌套和div设置的margin值的递增来实现圆角 </span>
<div class="rbottom"><div class="r5"></div><div class="r4"></div><div class="r3"></div><div class="r2"></div><div class="r1"></div></div>
</div>
<p>这个圆角框可以自由伸展,四个方向都能自适应,而且,不用图片</p>
<p><a href="http://www.zknight.net">返回骑士的博客</a></p>
</body>
</html>
相关文章推荐
- CSS页面布局
- CSS三栏布局
- CSS固定顶底之一
- 【转载】二十款好看的css字体样式
- 超简洁的CSS下拉菜单
- js获取css值的方法:style、getComputedStyle和currentStyle
- CSS 选择器
- 我应该使用哪种wsdl样式?
- CSS 概述
- css和js结局背景图自适应游览器大小
- getStyle(),修改样式属性
- css3 text-shadow
- 父窗口采用js控制iframe页面样式
- Html-Css-设置DIV边框圆滑
- 关于更改ListBox的ItemsPanel样式
- CSS: Float a div on another div, Ex: Text caption on picture
- css3 animation实现风车转动
- css绘制三角形方法
- 表格样式
- CSS3 transition transform