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

Add crontab scheduled tasks to debian docker container

Now most of the Docker images are based on Debian...

Javascript basics about built-in objects

Table of contents 1. Introduction to built-in obj...

Solution to the problem that the mysql8.0.11 client cannot log in

This article shares with you the solution to the ...

How to redirect PC address to mobile address in Vue

Requirements: The PC side and the mobile side are...

Tomcat uses thread pool to handle remote concurrent requests

By understanding how tomcat handles concurrent re...

The One-Hand Rule of WEB2.0

<br />My previous article about CSS was not ...

How to check the version of Kali Linux system

1. Check the kali linux system version Command: c...

JavaScript to implement a simple clock

This article example shares the specific code for...

How to create a MySQL master-slave database using Docker on MacOS

1. Pull the MySQL image Get the latest MySQL imag...

Select does not support double click dbclick event

XML/HTML CodeCopy content to clipboard < div c...

CenterOS7 installation and configuration environment jdk1.8 tutorial

1. Uninstall the JDK that comes with centeros fir...

Steps to build a Docker image using Dockerfile

Dockerfile is a text file that contains instructi...

Detailed explanation of Vue project packaging

Table of contents 1. Related configuration Case 1...

Native JS to achieve drag photo wall

This article shares with you a draggable photo wa...