css如何制作删除小图标
来源:网络收集 点击: 时间:2024-05-04打开html开发软件,新建一个html代码页面,然后创建一个div标签,同时给这个div添加一个class类,案例中class类为icon-del。
创建div代码:
div class=icon-del/div

创建一个没有上边框的圆角矩形。创建style标签,然后在该标签里面创建没有上边距的圆角矩形。
css样式代码:
.icon-del{
border:0.3em solid currentColor;
border-top: none;
border-radius:0 0 0.5em 0.5em;
width: 3em;
height: 2.8em;
margin: 50px auto;
position: relative;
}

保存html代码,使用浏览器打开,查看没有上边框的圆角矩形。

回到html代码页面,在矩形上使用after伪类添加一条直线。
css样式代码:
.icon-del::after{
content: ;
width: 5em;
height: 0.3em;
position: absolute;
top:-0.5em;
left: -1em;
background-color: currentcolor;
}

保存html代码,使用浏览器打开,可以看到一条直线已经添加成功。

回到html代码页面,在一条直线上添加一个没有下边框的圆角矩形。
css样式代码:
.icon-del::before{
content: ;
border-radius: 0.8em 0.8em 0 0;
position: absolute;
top:-1.6em;
left: 0.1em;
height: 0.8em;
width: 2.2em;
border:0.3em solid currentColor;
border-bottom: none;
}

保存html代码,然后使用浏览器打开即可看到删除小图标已经创建成功。

页面所有代码。可以直接复制所有代码到新建html页面,粘贴保存后使用浏览器打开即可看到效果。
所有代码:
!DOCTYPE html
html
head
meta charset=UTF-8
title删除小图标/title
style type=text/css
.icon-del{
border:0.3em solid currentColor;
border-top: none;
border-radius:0 0 0.5em 0.5em;
width: 3em;
height: 2.8em;
margin: 50px auto;
position: relative;
}
.icon-del::after{
content: ;
width: 5em;
height: 0.3em;
position: absolute;
top:-0.5em;
left: -1em;
background-color: currentcolor;
}
.icon-del::before{
content: ;
border-radius: 0.8em 0.8em 0 0;
position: absolute;
top:-1.6em;
left: 0.1em;
height: 0.8em;
width: 2.2em;
border:0.3em solid currentColor;
border-bottom: none;
}
/style
/head
body
div class=icon-del/div
/body
/html
注意事项可以直接查看最后一步骤,里面包含了制作小图标的所有代码。
CSSCSS删除图标CSS删除小图标CSS制作DEL图标版权声明:
1、本文系转载,版权归原作者所有,旨在传递信息,不代表看本站的观点和立场。
2、本站仅提供信息发布平台,不承担相关法律责任。
3、若侵犯您的版权或隐私,请联系本站管理员删除。
4、文章链接:http://www.1haoku.cn/art_672980.html