Pure CSS to achieve the function of √ in the lower right corner after selecting goods

Time:2021-2-25

Recommended articles:

CSS pseudo class click the bottom right corner to appear a diagonal sign, indicating the selected sample codehttps://www.jb51.net/css/731762.html

effect

在这里插入图片描述

Analysis:

1. Use pseudo element selector to add content.
2. Using wide border to achieve the background effect of √
3. Using transparent border to remove the redundant background color.
4. The √ sign is located in the right place by using the position of the son and the father.

CSS code:

&.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;
              /**Check size*/
              font-size: 10px;
              line-height: 8px;
              border: 10px solid;
              border-color: transparent #4884ff #4884ff transparent;
            }

summary

This article about pure CSS to achieve the function of displaying √ in the lower right corner of selected products is introduced here. For more related CSS to display √ in the lower right corner of selected products, please search previous articles of developer or continue to browse the following related articles. I hope you can support developer more in the future!