<!-- * @Description: * @Autor: kindring * @Date: 2022-02-16 16:15:10 * @LastEditors: kindring * @LastEditTime: 2022-02-16 17:00:53 * @LastDescript: --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div class="div"> <div class="t"></div> <div class="b"></div> </div> </body> <style> body { display: flex; height: 100vh; width: 100%; justify-content: center; align-items: center; background-color: rgb(53, 48, 48); } .div { width: 90%; height: 25%; position: relative; background-color: blueviolet; border: 3px solid white; border-radius: 5px; box-sizing: border-box; padding: 3px; } .div>.t, .div>.b { width: 30px; height: 30px; background-color: rgb(53, 48, 48); position: absolute; right: 30%; border: 3px solid white; border-radius: 50%; } .div>.t::before, .div>.b::before { display: block; content: ''; width: 200%; height: 100%; padding: 3px; position: absolute; background-color: rgb(53, 48, 48); left: -5px; } .div>.t { top: 0; transform: translate(0, -60%); } .div>.b { bottom: 0; transform: translate(0, 60%); } .div>.t::before { top: -6px; transform: translate(0, -40%); } .div>.b::before { bottom: -6px; transform: translate(0, 40%); } </style> </html>