Features:
1. Rounded border border-radius
2. The text has a background text- shadow
3. The button has a shadow box-shadow
4. The text has an upward shadow text-shadow
5. The button background color has a gradient from top to bottom Effect linear-gradient
6. There is obviously a click effect after clicking
<!DOCTYPE html><html> <head> <link rel="stylesheet" href="style.css"> <style> .btn{ background-color: #ee432e; background-image: -webkit-linear-gradient(top, #ee432e 0%, #c63929 50%,#b51700 50%, #891100 100%); background-image: -moz-linear-gradient(top, #ee432e 0%, #c63929 50%,#b51700 50%, #891100 100%); background-image: -o-linear-gradient(top, #ee432e 0%, #c63929 50%, #b51700 50%, #891100 100%); background-image: linear-gradient(top, #ee432e 0%, #c63929 50%, #b51700 50%, #891100 100%); border: 1px solid #951100; padding: 12px 20px 14px 20px; border-radius: 5px; text-decoration: none; color: #fff; font: bold 20px/1 “helvetica neue”, helvetica, arial, sans-serif; text-align: center; box-shadow: 0 1px 3px #333333; text-shadow: 0px -1px 1px rgba(0, 0, 0, 0.8); position:relative; display:inline-block; cursor:pointer; } .btn:active { position: relative; top: 1px; } </style> <script src="script.js"></script> </head> <body> <div class="btn">aaa</div> </body></html>
The reason why background-color is used when there is a gradient is that the browser does not support it When the gradient attribute is used, the background color is displayed, which has no three-dimensional effect:
Of course, lazy people can use http://css3button.net/ to generate css3 buttons:
Change the font size and the button size will also change