Baseline Widely availableThis feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Learn moreSee full compatibilityReport feedbackbutton 类型的 元素被渲染为简单的按钮,可以根据需要对其进行编程,可以为其分配一个事件处理函数(通常为 click 事件),以控制网页上的任何地方的自定义功能。

尝试一下

.styled {

border: 0;

line-height: 2.5;

padding: 0 20px;

font-size: 1rem;

text-align: center;

color: #fff;

text-shadow: 1px 1px 1px #000;

border-radius: 10px;

background-color: rgb(220 0 0 / 100%);

background-image: linear-gradient(

to top left,

rgb(0 0 0 / 20%),

rgb(0 0 0 / 20%) 30%,

rgb(0 0 0 / 0%)

);

box-shadow:

inset 2px 2px 3px rgb(255 255 255 / 60%),

inset -2px -2px 3px rgb(0 0 0 / 60%);

}

.styled:hover {

background-color: rgb(255 0 0 / 100%);

}

.styled:active {

box-shadow:

inset -2px -2px 3px rgb(255 255 255 / 60%),

inset 2px 2px 3px rgb(0 0 0 / 60%);

}

备注: button 类型的 元素仍然是合法的 HTML 代码,但是新的