CSS3快速上手之23:按钮样式说明2
2016-10-11 00:44
344 查看
1.代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>网页title</title>
<style>
/*---范例1:按钮边框颜色样式---*/
button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button1 {
background-color: white;
color: black;
border: 2px solid #4CAF50;
}
.button2 {
background-color: white;
color: black;
border: 2px solid #008CBA;
}
.button3 {
background-color: white;
color: black;
border: 2px solid #f44336;
}
.button4 {
background-color: white;
color: black;
border: 2px solid #e7e7e7;
}
.button5 {
background-color: white;
color: black;
border: 2px solid #555555;
}
/*---鼠标悬停按钮样式---*/
.button1:hover {background-color: #4CAF50; color: white;}
.button2:hover {background-color: #008CBA; color: white;}
.button3:hover {background-color: #f44336; color: white;}
.button4:hover {background-color: #e7e7e7; color: white;}
.button5:hover {background-color: #555555; color: white;}
/*---范例2:按钮阴影样式---*/
.button6 {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
}
.button7 {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
.button8:hover {
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);
}
/*---范例3:禁用按钮--*/
.button9 {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.disabled {
opacity: 0.6;
cursor: not-allowed;
}
/*---范例4:按钮宽度--*/
.button10 {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button11 {width: 250px;}
.button12 {width: 50%;}
.button13 {
padding-left: 0;
padding-right: 0;
width: 100%;
}
</style>
</head>
<body>
<p>范例1:按钮边框颜色+鼠标悬停按钮样式</p>
<button class="button button1">Green</button>
<button class="button button2">Blue</button>
<button class="button button3">Red</button>
<button class="button button4">Gray</button>
<button class="button button5">Black</button>
<p>范例2:按钮阴影样式</p>
<button class="button6 button7">阴影按钮</button>
<button class="button6 button8">鼠标悬停后出现阴影</button>
<p>范例3:禁用按钮样式</p>
<button class="button9">正常按钮</button>
<button class="button9 disabled">禁用按钮</button>
<p>范例4:按钮宽度</p>
<button class="button10 button11">250px</button><br>
<button class="button10 button12">50%</button><br>
<button class="button10 button13">100%</button>
</body>
</html>
2.结果:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>网页title</title>
<style>
/*---范例1:按钮边框颜色样式---*/
button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button1 {
background-color: white;
color: black;
border: 2px solid #4CAF50;
}
.button2 {
background-color: white;
color: black;
border: 2px solid #008CBA;
}
.button3 {
background-color: white;
color: black;
border: 2px solid #f44336;
}
.button4 {
background-color: white;
color: black;
border: 2px solid #e7e7e7;
}
.button5 {
background-color: white;
color: black;
border: 2px solid #555555;
}
/*---鼠标悬停按钮样式---*/
.button1:hover {background-color: #4CAF50; color: white;}
.button2:hover {background-color: #008CBA; color: white;}
.button3:hover {background-color: #f44336; color: white;}
.button4:hover {background-color: #e7e7e7; color: white;}
.button5:hover {background-color: #555555; color: white;}
/*---范例2:按钮阴影样式---*/
.button6 {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
}
.button7 {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
.button8:hover {
box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24),0 17px 50px 0 rgba(0,0,0,0.19);
}
/*---范例3:禁用按钮--*/
.button9 {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.disabled {
opacity: 0.6;
cursor: not-allowed;
}
/*---范例4:按钮宽度--*/
.button10 {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button11 {width: 250px;}
.button12 {width: 50%;}
.button13 {
padding-left: 0;
padding-right: 0;
width: 100%;
}
</style>
</head>
<body>
<p>范例1:按钮边框颜色+鼠标悬停按钮样式</p>
<button class="button button1">Green</button>
<button class="button button2">Blue</button>
<button class="button button3">Red</button>
<button class="button button4">Gray</button>
<button class="button button5">Black</button>
<p>范例2:按钮阴影样式</p>
<button class="button6 button7">阴影按钮</button>
<button class="button6 button8">鼠标悬停后出现阴影</button>
<p>范例3:禁用按钮样式</p>
<button class="button9">正常按钮</button>
<button class="button9 disabled">禁用按钮</button>
<p>范例4:按钮宽度</p>
<button class="button10 button11">250px</button><br>
<button class="button10 button12">50%</button><br>
<button class="button10 button13">100%</button>
</body>
</html>
2.结果:
相关文章推荐
- CSS3快速上手之22:按钮样式说明1
- CSS3快速上手之24:按钮样式说明3
- css3 按钮样式简单可扩展创建
- css3圆角样式分享自定义按钮样式
- 9种样式CSS3 渐变按钮集
- 移动端Web页面的CSS3 flex布局快速上手指南
- CSS3 input[type=file] 样式美化,input上传按钮美化
- Solr基础理论与维护管理快速上手(含查询参数说明)
- CSS3快速上手之3:边框的圆角
- Solr基础理论与维护管理快速上手(含查询参数说明)
- Solr基础理论与维护管理快速上手(含查询参数说明)
- CSS3快速上手之1:语法格式
- css3 线性渐变和径向渐变样式 分类: css3 button 按钮 渐变样式 2014-02-12 15:19 340人阅读 评论(0) 收藏
- CSS3 3D分页按钮样式
- Solr基础理论与维护管理快速上手(含查询参数说明)
- 纯CSS3动画按钮效果 5种漂亮样式
- Ajax+PHP快速上手及简单应用说明
- 36种漂亮的CSS3网页按钮Button样式
- 36种漂亮的CSS3网页按钮Button样式
- CSS3 重置iphone浏览器按钮input,select等表单元素的默认样式