css按钮自适应_html/css_WEB-ITnose

php中文网
发布: 2016-06-24 12:33:38
原创
1788人浏览过

原理:利用a标签和i标签各自一个背景组合成为按钮,达到自适应。

<!DOCTYPE html><html>    <head>        <meta charset="UTF-8">        <style type="text/css">        .btn a{text-decoration:none;}        .btn{display: inline-block; background: url(s_btn.png) no-repeat 0 0; height: 22px; line-height: 22px; color: #666; vertical-align:top;}        .btn i{display:block;font-style: normal; font-size: 12px; padding: 0 10px; background:url(s_btn.png) no-repeat right -22px; }        .btn:hover{text-decoration: none;color:#4c8136;background-position: 0 -44px;}        .btn:hover i{background-position: right -66px;}        .btn:active{background-position: 0 -88px;}        .btn:active i{background-position: right -110px;}        .btn_disabled, .btn_disabled:hover{background: url(../img/s_btn.png) no-repeat 0 -132px;cursor: default;}        .btn_disabled i, .btn_disabled:hover i, .s_btn_disabled:active i{background-position: right -154px;color:#999;}        </style>    </head>    <body>        <a href="#" class="btn"> <i>这是按钮</i> </a>        <a href="#" class="btn"> <i>按钮</i> </a>    </body></html>
登录后复制

效果:

             

Smart Picture
Smart Picture

Smart Picture 智能高效的图片处理工具

Smart Picture 77
查看详情 Smart Picture

 

HTML速学教程(入门课程)
HTML速学教程(入门课程)

HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号