css实现圆角效果的div,类似9宫格
2008-10-30 00:15
906 查看
先来段代码
<div class="dialog">
<div class="hd"><div class="c"></div></div>
<div class="bd"><div class="c"><div class="s">
<div class="roundbox">Text,text,text</div>
</div></div></div>
<div class="ft"><div class="c"></div></div>
</div>
这段html我们可以理解成下面的图形
再来看看css
<style type="text/css">
.dialog{
width:80%;
margin:0 auto;
min-width:20em;
}
.dialog .hd .c,.dialog .ft .c{
font-size:1px;
height:13px;
}
.dialog .ft .c{
height:14px;
}
.dialog .hd{
background:transparent url(image/tl.gif) no-repeat 0px 0px;
}
.dialog .hd .c{
background:transparent url(image/tr.gif) no-repeat right 0px;
}
.dialog .bd{
background:transparent url(image/ml.gif) repeat-y 0px 0px;
}
.dialog .bd .c{
background:transparent url(image/mr.gif) repeat-y right 0px;
}
.dialog .bd .c .s{
background:#000 url(image/ms.jpg) repeat-x 0px 0px;
margin:0px 8px 0px 4px;
padding:1em;
}
.dialog .ft{
background:transparent url(image/bl.gif) no-repeat 0px 0px;
}
.dialog .ft .c{
background:transparent url(image/br.gif) no-repeat right 0px;
}
.roundbox{
color:#FFFFFF;
line-height:150%;
font-size:1em;
}
</style>
加上这段css呢,效果如下图
最终呈现效果
实例中的边角图,可以在这里下载
http://15daysofjquery.com/examples/rounded/tl.gif
http://15daysofjquery.com/examples/rounded/tr.gif
http://15daysofjquery.com/examples/rounded/ml.gif
http://15daysofjquery.com/examples/rounded/mr.gif
http://15daysofjquery.com/examples/rounded/ms.jpg
http://15daysofjquery.com/examples/rounded/bl.gif
http://15daysofjquery.com/examples/rounded/br.gif
综合分析
配合css,理解哈~!
顺便提下Jquery,来试试配合JQuery使用圆角效果
$(document).ready(function(){ $("div.roundbox") .wrap('<div
class="dialog">'+
'<div class="bd">'+
'<div class="c">'+
'<div class="s">'+
'</div>'+
'</div>'+
'</div>'+
'</div>');
});
我们在页面上真正需要的就是一个内容div roundbox,没有Jquery我们要把修饰的div添加到页面,这么多的div却被用来修饰样式,真是可悲。
有空来分析这个页面 http://15daysofjquery.com/examples/rounded/demo.php
<div class="dialog">
<div class="hd"><div class="c"></div></div>
<div class="bd"><div class="c"><div class="s">
<div class="roundbox">Text,text,text</div>
</div></div></div>
<div class="ft"><div class="c"></div></div>
</div>
这段html我们可以理解成下面的图形
再来看看css
<style type="text/css">
.dialog{
width:80%;
margin:0 auto;
min-width:20em;
}
.dialog .hd .c,.dialog .ft .c{
font-size:1px;
height:13px;
}
.dialog .ft .c{
height:14px;
}
.dialog .hd{
background:transparent url(image/tl.gif) no-repeat 0px 0px;
}
.dialog .hd .c{
background:transparent url(image/tr.gif) no-repeat right 0px;
}
.dialog .bd{
background:transparent url(image/ml.gif) repeat-y 0px 0px;
}
.dialog .bd .c{
background:transparent url(image/mr.gif) repeat-y right 0px;
}
.dialog .bd .c .s{
background:#000 url(image/ms.jpg) repeat-x 0px 0px;
margin:0px 8px 0px 4px;
padding:1em;
}
.dialog .ft{
background:transparent url(image/bl.gif) no-repeat 0px 0px;
}
.dialog .ft .c{
background:transparent url(image/br.gif) no-repeat right 0px;
}
.roundbox{
color:#FFFFFF;
line-height:150%;
font-size:1em;
}
</style>
加上这段css呢,效果如下图
最终呈现效果
实例中的边角图,可以在这里下载
http://15daysofjquery.com/examples/rounded/tl.gif
http://15daysofjquery.com/examples/rounded/tr.gif
http://15daysofjquery.com/examples/rounded/ml.gif
http://15daysofjquery.com/examples/rounded/mr.gif
http://15daysofjquery.com/examples/rounded/ms.jpg
http://15daysofjquery.com/examples/rounded/bl.gif
http://15daysofjquery.com/examples/rounded/br.gif
综合分析
配合css,理解哈~!
顺便提下Jquery,来试试配合JQuery使用圆角效果
$(document).ready(function(){ $("div.roundbox") .wrap('<div
class="dialog">'+
'<div class="bd">'+
'<div class="c">'+
'<div class="s">'+
'</div>'+
'</div>'+
'</div>'+
'</div>');
});
我们在页面上真正需要的就是一个内容div roundbox,没有Jquery我们要把修饰的div添加到页面,这么多的div却被用来修饰样式,真是可悲。
有空来分析这个页面 http://15daysofjquery.com/examples/rounded/demo.php
相关文章推荐
- div+css实现圆角即网页上常用的圆角效果
- JS+DIV+CSS实现类似邮件发送时的蒙板效果
- DIV+CSS圆角效果的简易实现
- div+css实现圆角效果
- [37期]DIV+CSS圆角效果的简易实现[原创]
- css实现类似相框的阴影div的shadow效果
- css+div实现圆角
- CSS3实现DIV圆角效果完整代码
- css+div实现圆角矩形代码总结
- JS+DIV+CSS实现仿表单下拉列表效果
- JS+DIV+CSS排版布局实现美观的选项卡效果
- 纯DIV+CSS简单实现Tab选项卡左右切换效果
- DIV+CSS实现放大镜效果的分页样式
- Javascript实现的类似Google的Div拖动效果代码
- 纯DIV+CSS实现圆角代码
- css实现跨浏览器的box-shadow盒阴影效果告别图片实现类似效果(2)
- div+css+js实现无缝滚动类似marquee无缝滚动兼容firefox
- div+css实现两列table效果示例
- jquery实现隔行变色,点击换色,鼠标悬浮当前行变色效果,div+css 细表格样式
- div+css实现圆形div以及带箭头提示框效果