标签:color height 一套 background 按钮 手写 btn border
预览效果:
1、定义所有button的默认样式
.btn{
user-select: none;
padding: 0 10px;
border-radius: 4px;
border: 1px solid transparent;
display: inline-block;
height: 38px;
line-height: 38px;
white-space: nowrap;
text-decoration: none;
}
.btn, .btn:active, .btn:focus {
outline: 0;
}
2、定义按钮的大小
/*大型按钮*/
.btn-lg{
height: 44px;
line-height: 44px;
padding: 0 25px;
font-size: 16px;
}
/*小型按钮*/
.btn-sm{
height: 30px;
line-height: 30px;
font-size: 12px;
}
/*迷你按钮*/
.btn-xs{
height: 22px;
line-height: 22px;
padding: 0 5px;
font-size: 12px;
}
3、自定义一个默认按钮
.btn-default{
cursor: pointer;
background: #fff;
border: 1px solid #dcdfe6;
color: #606266;
}
.btn-default:hover, .btn-default:focus{
border-color: #c6e2ff;
color: #409eff;
background-color: #ecf5ff;
}
.btn-default:active{
border-color: #3a8ee6;
color: #3a8ee6;
}
4、完整源码
HTML
<button type="button" class="btn btn-disabled btn-lg ml10">禁用按钮</button>
<button type="button" class="btn btn-disabled ml10">禁用按钮</button>
<button type="button" class="btn btn-disabled btn-sm ml10">禁用按钮</button>
<button type="button" class="btn btn-disabled btn-xs ml10">禁用按钮</button>
<br/>
<br/>
<button type="button" class="btn btn-primary btn-lg ml10">主要按钮</button>
<button type="button" class="btn btn-primary ml10">主要按钮</button>
<button type="button" class="btn btn-primary btn-sm ml10">主要按钮</button>
<button type="button" class="btn btn-primary btn-xs ml10">主要按钮</button>
<br/>
<br/>
<button type="button" class="btn btn-default btn-lg ml10">默认按钮</button>
<button type="button" class="btn btn-default ml10">默认按钮</button>
<button type="button" class="btn btn-default btn-sm ml10">默认按钮</button>
<button type="button" class="btn btn-default btn-xs ml10">默认按钮</button>
<br/>
<br/>
<button type="button" class="btn btn-success btn-lg ml10">成功按钮</button>
<button type="button" class="btn btn-success ml10">成功按钮</button>
<button type="button" class="btn btn-success btn-sm ml10">成功按钮</button>
<button type="button" class="btn btn-success btn-xs ml10">成功按钮</button>
<br/>
<br/>
<button type="button" class="btn btn-warning btn-lg ml10">警告按钮</button>
<button type="button" class="btn btn-warning ml10">警告按钮</button>
<button type="button" class="btn btn-warning btn-sm ml10">警告按钮</button>
<button type="button" class="btn btn-warning btn-xs ml10">警告按钮</button>
<br/>
<br/>
<button type="button" class="btn btn-danger btn-lg ml10">危险按钮</button>
<button type="button" class="btn btn-danger ml10">危险按钮</button>
<button type="button" class="btn btn-danger btn-sm ml10">危险按钮</button>
<button type="button" class="btn btn-danger btn-xs ml10">危险按钮</button>
<br/>
<br/>
<button type="button" class="btn btn-import ml10">导入按钮</button>
<button type="button" class="btn btn-export ml10">导出按钮</button>
CSS
.ml10{
margin-left: 10px;
}
.ml5{
margin-left: 5px;
}
.ml8{
margin-left: 8px;
}
/*默认按钮*/
.btn{
user-select: none;
padding: 0 10px;
border-radius: 4px;
border: 1px solid transparent;
display: inline-block;
height: 38px;
line-height: 38px;
white-space: nowrap;
text-decoration: none;
}
.btn, .btn:active, .btn:focus {
outline: 0;
}
/*大型按钮*/
.btn-lg{
height: 44px;
line-height: 44px;
padding: 0 25px;
font-size: 16px;
}
/*小型按钮*/
.btn-sm{
height: 30px;
line-height: 30px;
font-size: 12px;
}
/*迷你按钮*/
.btn-xs{
height: 22px;
line-height: 22px;
padding: 0 5px;
font-size: 12px;
}
/*禁用按钮*/
.btn-disabled, .btn-disabled:hover, .btn-disabled:active {
border-color: #e6e6e6;
background-color: #eee;
background-image: none;
cursor: not-allowed;
color: #999;
}
/*主要按钮*/
.btn-primary{
color: #fff;
background-color: #409eff;
border-color: #409eff;
}
.btn-primary:hover, .btn-primary:focus {
cursor: pointer;
background: #66b1ff;
border-color: #66b1ff;
color: #fff;
}
.btn-primary:active, .btn-primary.active {
color: #fff;
background-color: #3a8ee6;
border-color: #3a8ee6;
}
/*默认按钮*/
.btn-default{
cursor: pointer;
background: #fff;
border: 1px solid #dcdfe6;
color: #606266;
}
.btn-default:hover, .btn-default:focus{
border-color: #c6e2ff;
color: #409eff;
background-color: #ecf5ff;
}
.btn-default:active{
border-color: #3a8ee6;
color: #3a8ee6;
}
/*成功按钮*/
.btn-success{
background-color: #1FBB7D;
color: #fff;
}
.btn-success:hover, .btn-success:focus{
cursor: pointer;
background-color: #59cd9f;
border-color: #59cd9f;
color: #fff;
}
.btn-success:active{
background-color: #199463;
border-color: #1FBB7D;
}
/*警告按钮*/
.btn-warning{
color: #e6a23c;
background-color: #fdf6ec;
border-color: #ffeba9;
}
.btn-warning:hover, .btn-warning:focus{
cursor: pointer;
background-color: #fdf6ec;
border-color: #faad14;
}
.btn-warning:active{
background-color: #fEE692;
border-color: #fEE692;
}
/*危险按钮*/
.btn-danger{
cursor: pointer;
background-color: #f56c6c;
border-color: #f56c6c;
color: #fff;
}
.btn-danger:hover, .btn-danger:focus{
color: #fff;
background-color: #ff7875;
border-color: #ff7875;
}
.btn-danger:active{
background-color: #d9363e;
border-color: #d9363e;
}
/*导出和导入按钮*/
.btn-export, .btn-import{
cursor: pointer;
border-color: #9095a1;
background-color: #fff;
}
.btn-export{
color: #f7674e;
}
.btn-import{
color: #395bcc;
}
.btn-export:hover, .btn-import:hover, .btn-export:focus, .btn-import:focus{
border-color: #677088;
background-color: #eeeeee;
}
.btn-dashed{
color: #515a6e;
background-color: #fff;
border-color: #dcdee2;
border-style: dashed
}
.btn-dashed:hover, .btn-dashed:focus{
color: #57a3f3;
background-color: #fff;
border-color: #57a3f3
}
.btn-dashed:active{
color: #2b85e4;
background-color: #fff;
border-color: #2b85e4
}
标签:color,height,一套,background,按钮,手写,btn,border 来源: https://blog.csdn.net/han12398766/article/details/106061392
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。