Home >Web Front-end >CSS Tutorial >How to set shadow for button in css

How to set shadow for button in css

藏色散人
藏色散人Original
2021-03-22 16:41:324852browse

How to set a shadow for a button using css: first create an HTML sample file; then set a button button; and finally add attributes such as "box-shadow" to the button to achieve the shadow effect.

How to set shadow for button in css

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, DELL G3 computer

css3 makes a button button with a shadow

Effect comparison before and after swiping the mouse:

How to set shadow for button in css

<!--html代码-->
<input class="but" type = "button" value = "确认" />
<!--css代码-->
<style type="text/css">
 .but{
 border: 0px groove orange;
 box-shadow: 5px 6px 10px #000;
 margin-left: 160px;
 border-radius: 10px;
 background: #034c92;
 color: white;
 width: 250px;
 height: 40px;
 font-size: 20px;
 }
 .but:hover{
 box-shadow: 8px 10px 10px #000;
 background: #005DF9;
 }
 </style>

[Recommended learning: css video tutorial]

The above is the detailed content of How to set shadow for button in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn