原理很简单;
关闭按钮:通过盒子的伪元素(::before和::after)实现关闭那俩叉;
选项按钮:同上,不同的是要借用一个i标签;
直接写好demo拉走,很短,包含两个按钮样式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>button</title>
</head>
<style>
div {
width: 50px;
height: 50px;
border-radius: 0 50% 50% 50%;
background: #80bd01;
margin: 10px auto;
position: relative;
}
/*关闭按钮*/
.close::before, .close::after {
content: '';
width: 4px;
height: 30px;
background: #000;
position: absolute;
top: 11px;
left: 22px;
}
.close::before {
transform: rotate(45deg);
}
.close::after {
transform: rotate(-45deg);
}
/*选项按钮,自己实现时去掉hover就行*/
.option::before ,.option::after, .option i {
content: '';
width: 28px;
height: 4px;
background: #000;
position: absolute;
top: 12px;
left: 11px;
}
.option i {
top: 22px;
}
.option::after {
top: 32px;
}
</style>
<body>
<div class="close"></div>
<div class="option">
<i></i>
</div>
</body>
</html>