css3记录页面中常用样式的写法

在用wordpress开发主题的时候,经常避免不了要写各种样式的按钮,下面记录一下用按钮样式的写法,以后用的时候直接拿来即可。

在这里插入图片描述

HTML和CSS代码

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <style type="text/css">
            *{margin: 0; padding: 0;}
            .container{
                margin: 0 auto;
                padding-top: 30px;
                width: 1000px;
            }
            .btn{
                display: inline-block;
                padding: 0 30px;
                width: auto;
                height: 35px;
                font: 14px/35px 'microsoft yahei';
                color: #fff; border: 0;
                border-radius: 3px;
                text-align: center;
                cursor: pointer;
                -webkit-transition: all .5s;
                -moz-transition: all .5s;
                -ms-transition: all .5s;
                -o-transition: all .5s;
                transition: all .5s;
            }
            .blueBtn{
                background: #5dcbff;
            } /*蓝色按钮*/
            .blueBtn:hover{
                background: #40b6ee;
            }
            .orangeBtn{
                background: #ff5700;
            }/*橙色按钮*/
            .orangeBtn:hover{
                background: #e25d18;
            }
            .violetBtn{
                background: #6680ff;
            }/*紫色按钮*/
            .violetBtn:hover{
                background: #425de0;
            }
            .grayBtn{
                background: #999;
            }/*灰色按钮*/
            .grayBtn:hover{
                background: #7f7f7f;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <span class="btn blueBtn">蓝色按钮</span>
            <span class="btn orangeBtn">橙色按钮</span>
            <span class="btn violetBtn">紫色按钮</span>
            <span class="btn grayBtn">灰色按钮</span>
        </div>
    </body>
</html>

欢迎关注我的公众号“xx主题网”,原创技术文章第一时间推送。

文章来源:https://www.xxzhuti.com/392.html


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值