使用動態偽類選擇器美化按鈕
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>使用動態偽類選擇器美化按鈕</title>
<style type="text/css">
*{
text-align: center;
}
/*默認狀態下的按鈕效果*/
.btn{
background-color: #0074cc;
*backgroud-color: #0075cc;
/*CSS3漸變制作背景圖片*/
background-image:linear-gradient(top,#0088cc,#0055cc);
background-repeat: repeat-x;
display: inline-block;
*display:inline;
border: 1px solid #ccc;
*border:0;
border-color: #ccc;
/*CSS的色彩模塊*/
border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
border-radius: 6px;
color: #ffffff;
cursor: pointer;
/* pointer 光標呈現為指示鏈接的指針(一只手)*/
font-size: 20px;
text-decoration: none;
/*去掉下劃線
*/
font-weight: normal;
padding: 14px 24px;
text-align: center;
/* CSS文字陰影特性*/
text-shadow: 0 -1px 0 rgb(0,0,0,0.25);
vertical-align: middle;
*zoom:1;
}
/* 懸浮狀態下按鈕效果*/
.btn:hover{
background-position: 0 -15px;
background-color: #0055cc;
*bakground-color:#004ab3;
color: #ffffff;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
/* CSS動畫效果*/
transition: background-position 0.1s linear;
}
/* 點擊時按鈕效果*/
.btn:active{
background-color: #0055cc;
background-color: #004099 \9;
background-image: none;
outline: 0;
/* CSS盒子陰影特性*/
box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
color: rgba(255,255,255,0.75);
}
/* 獲得焦點按鈕效果*/
.btn:focus{
outline: thin dotted #333;
outline: 5px auto;
outline-offset: -2px;
}
</style>
</head>
<body>
<div>
<a href="#" class="btn">View project on GitHub</a>
</div>
</body>
</html>
使用動態偽類選擇器美化按鈕