纯CSS实现选中商品后右下角显示√号功能

纯CSS实现选中商品后右下角显示√号功能

推荐文章:

css伪类 右下角点击出现 对号角标表示选中的示例代码 https://www.jb51.net/css/731762.html

效果

解析:

1、利用伪元素选择器,来增加内容。
2、利用较宽的border实现√号的背景效果
3、利用透明border去掉多余背景色。
4、利用子绝父相定位,将√号定位到合适位置。

css代码:

 &.selected{
              color: @theme;
              border: 0.02rem solid @theme;
              position: relative;
              transition: all 0.5s ease;
            }
            &.selected::after {
              content: '';
              display: block;
              height: 0px;
              width: 0px;
              position: absolute;
              bottom: 0;
              right: 0;
              color:#fff;
              /**对号大小*/
              font-size: 10px;
              line-height: 8px;
              border: 10px solid;
              border-color: transparent #4884ff #4884ff transparent;
            }

总结

到此这篇关于纯CSS实现选中商品后右下角显示√号功能的文章就介绍到这了,更多相关css 选中商品右下角显示√号内容请搜索自由互联以前的文章或继续浏览下面的相关文章,希望大家以后多多支持自由互联!

纯CSS实现选中商品后右下角显示√号功能

相关文章:

你感兴趣的文章:

标签云: