One, the simplest bubble

1. The rendering

Code 2.

<! DOCTYPE html><html lang="ch">
    <head>
        <meta charset="UTF-8">
        <title>test</title>
        <style>
            .bubble-box {
                position: relative;
                border: 2px solid #0038ff;
                border-radius: 5px;
                width: 200px;
                height: 50px;
                line-height: 50px;
                text-align: center;
                margin-left: 20px;
            }

            .bubble-box::before {
                content: "";
                position: absolute;
                right: 100%;
                top: 50%;
                margin: -5px 0 0;
                border: 10px solid transparent;
                border-right-color: #0038ff;
            }

            .bubble-box::after {
                content: "";
                position: absolute;
                right: 100%;
                top: 50%;
                margin-top: -2px;
                border: 7px solid transparent;
                border-right-color: #fff;
            }
        </style>
    </head>
    <body>
        <div class="bubble-box">Walking bug maker</div>
    </body>
</html>
Copy the code

3. The train of thought

The small triangle on the left uses the pseudo-class ::beforeSmall triangle needs to have a small triangle with a white background to cover the colored small triangle, need to use ::after

Oblique triangle bubble

1. The rendering

Code 2.

<! DOCTYPE html><html lang="ch">
    <head>
        <meta charset="UTF-8">
        <title>test</title>
        <style>
            .bubble-box {
                position: relative;
                border: 2px solid #0038ff;
                border-radius: 5px;
                width: 200px;
                height: 50px;
                line-height: 50px;
                text-align: center;
                margin-left: 20px;
            }

            .bubble-box::before {
                content: "";
                position: absolute;
                border: 10px solid transparent;
                border-top-color: #0038ff;
                border-right-color: #0038ff;
                right: 100%;
                top: 8%;
                transform: skewY(16deg);
            }
        </style>
    </head>
    <body>
        <div class="bubble-box">Walking bug maker</div>
    </body>
</html>
Copy the code

3. The train of thought

It’s the same as the simple bubble principle, except instead of using the after pseudo-class, use transform to tilt the Angle to achieve the effect

Three, drag tail gas bubble

1. The rendering

Code 2.

<! DOCTYPE html><html lang="ch">
    <head>
        <meta charset="UTF-8">
        <title>test</title>
        <style>
            .bubble-box {
                position: relative;
                color: #fff;
                border: 2px solid #0038ff;
                background: #0038ff;
                border-radius: 25px;
                width: 200px;
                height: 50px;
                line-height: 50px;
                text-align: center;
                margin-left: 20px;
            }

            .bubble-box::before {
                content: "";
                position: absolute;
                z-index: -1;
                bottom: -5px;
                right: -8px;
                height: 22px;
                border-right: 20px solid #0038ff;
                border-bottom-left-radius: 15px 15px;
                transform: translate(0, -2px);
            }

            .bubble-box::after {
                content: "";
                position: absolute;
                z-index: 1;
                bottom: -5px;
                right: -58px;
                width: 26px;
                height: 22px;
                background: #fff;
                border-bottom-left-radius: 10px;
                transform: translate(-30px, -2px);
            }
        </style>
    </head>
    <body>
        <div class="bubble-box">Walking bug maker</div>
    </body>
</html>
Copy the code

3. The train of thought

The tail is implemented in the same way as the triangle, except that the arc of the tail is border-bottom-left-radius: 15px 15px