合元网络

标题: css学习-CSS背景图片自适应文字宽度圆角按钮 [打印本页]

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







欢迎光临 合元网络 (http://www.heyuan18.com/) Powered by Discuz! X3.2