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

Example of fork and mutex lock process in Linux multithreading

Table of contents Question: 1. First attempt 2. R...

MySQL uses frm files and ibd files to restore table data

Table of contents Introduction to frm files and i...

HTML simple shopping quantity applet

This article shares a simple HTML shopping quanti...

Detailed explanation of Docker working mode and principle

As shown in the following figure: When we use vir...

One sql statement completes MySQL deduplication and keeps one

A few days ago, when I was working on a requireme...

Docker installation tomcat dubbo-admin instance skills

1. Download the tomcat image docker pull tomcat:8...

Use pure JS to achieve the secondary menu effect

This article example shares the specific code of ...

Why is the scroll bar on the web page set on the right?

Why are the scroll bars of the browsers and word ...

How to change mysql password under Centos

1. Modify MySQL login settings: # vim /etc/my.cnf...

How to obtain a permanent free SSL certificate from Let's Encrypt in Docker

1. Cause The official cerbot is too annoying. It ...

How to use Docker to build a development environment (Windows and Mac)

Table of contents 1. Benefits of using Docker 2. ...

MySQL Quick Data Comparison Techniques

In MySQL operation and maintenance, a R&D col...

Universal solution for MySQL failure to start under Windows system

MySQL startup error Before installing MySQL on Wi...