日期:2014-05-16  浏览次数:20762 次

妙味云课堂之css:滑动门、圆角、css精灵

一. css滑动门

滑动门并不是一项全新的技术,它是利用背景图像的可层叠性,并允许他们在彼此之上进行滑动,以创造一些特殊的效果。 

①、三层嵌套

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
.btn{width:100px;background:url(img/btn.png) repeat-x;}
.btnL{background:url(img/btnL.png) no-repeat;}
.btnR{height:31px; background:url(img/btnR.png) no-repeat right 0;}
</style>
</head>
<body>
<div class="btn">
	<div class="btnL">
    	<div class="btnR">妙味课堂</div>
    </div>
</div>
</body>
</html>
②、两层嵌套

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<style>
.btn{width:200px;background:url(img/btn2.png) no-repeat;}
.btnR{height:31px; background:url(img/btnR.png) no-repeat right 0;}
</style>
</head>
<body>
<div class="btn">
	<div class="btnR">妙味课堂</div>
</div>
</body>
</html>
** 扩展要求高,图片比较大的 用三层嵌套
** 扩展要求不高,图片比较小的 用两层嵌套