CSS to achieve the small sharp corner effect of bubbles

CSS to achieve the small sharp corner effect of bubbles

Effect picture (the border color is too light, put it in {}):

{ }

Reference link Pure CSS bubble effect

Knowledge points needed:

When the width and height of the div are both 0, the entire border is composed of four triangles, one triangle on each side. This can be used to make small sharp corners, such as the following:

Set the color of the three unnecessary borders to the same as the background, so that you can get the desired small pointed corners, and then use positioning to adjust the position.

The above method can get a small pointed corner with color, but the effect is to show a small golden corner with a border. So on the basis of the existing ones, two small sharp corners appear, and then they are superimposed and displayed using the z-index attribute. Because two are needed, pseudo elements can be used so that no non-semantic elements appear. The code is as follows:

&::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border: solid 10px;
    border-color: #E9E9E9 rgba(255, 255, 255, 0)
          rgba(255, 255, 255, 0) rgba(255, 255, 255, 0);
    position: absolute;
    top: 208px;
    left: 40px;
    z-index: 2;
}

&::after {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border: solid 8px;
    border-color: #fff rgba(255, 255, 255, 0) 
        rgba(255, 255, 255, 0) rgba(255, 255, 255, 0);
    position: absolute;
    top: 207px;
    left: 41.5px;
    z-index: 3;
}

Summarize

This is the end of this article about how to achieve the small pointed corner effect of bubbles with CSS. For more relevant CSS bubble small pointed corner content, please search 123WORDPRESS.COM’s previous articles or continue to browse the related articles below. I hope that everyone will support 123WORDPRESS.COM in the future!

<<:  The webpage cannot be opened because the div element lacks a closing tag

>>:  Detailed explanation of several storage methods of docker containers

Recommend

14 Ways to Create Website Content That Engages Your Visitors

When I surf the Net, I often see web sites filled...

Theory Popularization——User Experience

1. Concept Analysis 1: UE User Experience <br ...

Implementation example of nginx access control

About Nginx, a high-performance, lightweight web ...

Detailed explanation of Zabbix installation and deployment practices

Preface Zabbix is ​​one of the most mainstream op...

Docker data storage tmpfs mounts detailed explanation

Before reading this article, I hope you have a ba...

How to run MySQL using docker-compose

Directory Structure . │ .env │ docker-compose.yml...

Organize the common knowledge points of CocosCreator

Table of contents 1. Scene loading 2. Find Node 1...

Detailed steps to build an NFS file sharing server in Linux

Linux builds NFS server In order to achieve data ...

MySQL performance optimization: how to use indexes efficiently and correctly

Practice is the only way to test the truth. This ...

How to use vw+rem for mobile layout

Are you still using rem flexible layout? Does it ...

How to implement Linux deepin to delete redundant kernels

The previous article wrote about how to manually ...

Analysis of MySQL lock mechanism and usage

This article uses examples to illustrate the MySQ...

Commonly used JavaScript array methods

Table of contents 1. filter() 2. forEach() 3. som...