测试代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body{
margin:0px;
padding:0px;
background-color: gray;
}
.myButton{
background-color:rgb(200, 0, 0);
width:120px;
height:50px;
border:none;
color:white;
font-size:18px;
cursor:pointer;
position:relative;
left:100px;
top:100px;
}
.myButton:hover, .myButton:active{
background-color: rgb(230,0,0);
}
.myButton:focus{
outline:none;
}
</style>
</head>
<body>
<button class="myButton">按钮</button>
</body>
</html>
运行截图
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/5bfa4b0a2d191f82a78785e8f2f864b4.png)