如何使用 CSS 创建复选标记/对勾
我们可以使用 CSS 创建自定义复选标记。以下示例展示了这种效果 −
示例
<!DOCTYPE html>
<html>
<style>
div {
margin: 2%;
position: relative;
width: 40px;
height: 40px;
box-shadow: inset 0 0 12px lightblue;
}
div::before {
content: "";
position: absolute;
width: 8px;
top: 50%;
height: 50%;
border-radius: 2px;
background-color: rgb(123,45,20);
transform: translateX(12px) rotate(-45deg);
transform-origin: left bottom;
z-index: +1;
}
div::after {
content: "";
position: absolute;
bottom: 0;
height: 8px;
width: 100%;
border-radius: 2px;
background-color: rgb(200,52,120);
transform: translateX(12px) rotate(-45deg);
transform-origin: left bottom;
}
</style>
<body>
Custom mark!
<div></div>
</body>
</html>输出
将产生以下结果 −

示例
<!DOCTYPE html>
<html>
<style>
body {
padding: 2%;
text-align: center;
}
div {
display: inline-block;
height: 100px;
width: 35px;
border-bottom: 10px solid chartreuse;
border-right: 10px solid chartreuse;
transform: rotate(45deg);
}
</style>
<body>
<div></div>
</body>
</html>输出
将产生以下结果 −

广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
JavaScript
PHP