合元网络
标题:
css学习-CSS背景图片自适应文字宽度圆角按钮
[打印本页]
作者:
admin
时间:
2016-10-15
标题:
css学习-CSS背景图片自适应文字宽度圆角按钮
1、此CSS模块CSS代码:
*{margin:0; padding:0;}
body{padding:10px; font-size:12px;}
h1{margin:0; padding:10px 0; font-size:14px; font-weight:bold;}
.div a{background:url(divcss5.gif) left 0; color:#fff; text-decoration:none;
height:30px; float:left; cursor:hand; margin:0 5px 0 0;}
.div a:hover{background:url(divcss5.gif) left -30px;height:30px;}
.div a span{background:url(divcss5.gif) right 0; padding:7px 8px 7px 0;
margin:0 0 0 8px; float:left; height:16px;}
.div a:hover span{background:url(divcss5.gif) right -30px; color:#000;
padding:7px 8px 7px 0; margin:0 0 0 8px; height:16px; }
2、此模块HTML源代码片段:
<div class="div">
<a href="http://www.divcss5.com/"><span>首页</span></a>
<a href="http://www.divcss5.com/" target="_blank"><span>DIV CSS</span></a>
<a href="http://www.divcss5.com/template/" target="_blank"><span>DIV CSS模块</span></a>
<a href="http://www.divcss5.com/peixun/" target="_blank"><span>学习CSS上DIVCSS5!</span></a>
<a href="http://www.divcss5.com/shouce/" target="_blank">
<span>CSS手册 可以查询常见属性</span></a>
</div>
3、圆角背景谁文字增加而自适应,鼠标经过同时背景变化。
复制代码
欢迎光临 合元网络 (http://www.heyuan18.com/)
Powered by Discuz! X3.2