Набор правил CSS3 для создания кнопок
Набор правил CSS для создания кнопок используя теги <a> <input> и <button>
by Andrey Dobrovoi
HTML
<article>
<p>
<a href="#" class="btn">Кнопка</a>
<button>Кнопка</button>
<input type="submit" value="Кнопка">
</p>
<p>
<a href="#" class="btn btn_blue">Кнопка</a>
<button class="btn_blue">Кнопка</button>
<input class="btn_blue" type="submit" value="Кнопка">
</p>
<p>
<a href="#" class="btn btn_red">Кнопка</a>
<button class="btn_red">Кнопка</button>
<input class="btn_red" type="submit" value="Кнопка">
</p>
<p>
<a href="#" class="btn btn_green">Кнопка</a>
<button class="btn_green">Кнопка</button>
<input class="btn_green" type="submit" value="Кнопка">
</p>
</article>
CSS
/* Базовые стили кнопок */
.btn, input[type="submit"], button {
background: #f1f1f1;
background-image: -webkit-linear-gradient(top, #fcfcfc, #e0e0e0);
background-image: -moz-linear-gradient(top, #fcfcfc, #e0e0e0);
background-image: -ms-linear-gradient(top, #fcfcfc, #e0e0e0);
background-image: -o-linear-gradient(top, #fcfcfc, #e0e0e0);
background-image: linear-gradient(to bottom, #fcfcfc, #e0e0e0);
-webkit-border-radius: 3;
-moz-border-radius: 3;
border-radius: 3px;
font-family: Arial;
color: #444;
font-size: 13px;
padding: 10px 23px 10px 23px;
border: solid #B3B3B3 1px;
text-decoration: none;
cursor: pointer;
outline: none;
}
.btn:hover, input[type="submit"]:hover, button:hover,
.btn:active, input[type="submit"]:active, button:active {
background: #fcfcfc;
background-image: -webkit-linear-gradient(top, #fcfcfc, #d0d0d0);
background-image: -moz-linear-gradient(top, #fcfcfc, #d0d0d0);
background-image: -ms-linear-gradient(top, #fcfcfc, #d0d0d0);
background-image: -o-linear-gradient(top, #fcfcfc, #d0d0d0);
background-image: linear-gradient(to bottom, #fcfcfc, #d0d0d0);
text-decoration: none;
}
.btn:active, input[type="submit"]:active, button:active {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-moz-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-o-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}
/* Синие Кнопки */
.btn_blue, input[type="submit"].btn_blue, button.btn_blue{
background: #0aa0c6;
background-image: -webkit-linear-gradient(top, #0aa0c6, #0788a8);
background-image: -moz-linear-gradient(top, #0aa0c6, #0788a8);
background-image: -ms-linear-gradient(top, #0aa0c6, #0788a8);
background-image: -o-linear-gradient(top, #0aa0c6, #0788a8);
background-image: linear-gradient(to bottom, #0aa0c6, #0788a8);
border: solid #0788a8 1px;
color: #ffffff;
}
...