🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 图示 ![mark](http://qiniu.newthink.cc/blog/180921/Cgl5AKF1mi.png) # GIT 地址:https://gitee.com/hongweizhiyuan/ijquery_front/tree/master/image_delete 演示:https://hongweizhiyuan.gitee.io/ijquery_front/image_delete/index-css-jquery.html # 代码 ``` <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" /> <meta name="format-detection" content="telephone=no, email=no, date=no, address=no"> <title>CSS的删除按钮</title> <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script> <style type="text/css"> .img_div{ display : inline-block; position : relative; } .img_div .delete{ position : absolute; top : 5px; right : 5px; color: red; border: 1px solid red; text-align: center; cursor: pointer; border-radius: 20px; width : 20px; height : 20px; line-height: 20px; } </style> </head> <body> <h2>CSS的删除按钮</h2> <div class="img_div"> <img src="image.jpg" width="300" height="200"/> <div class="delete">x</div> </div> </body> <script> $(function () { //删除操作 $('.delete').click(function () { $(this).parent().remove(); }) }) </script> </html> ```