1. Use CSS to draw a small pointed-corner chat dialog box and a speech bubble with pointed corners. Let me show you the effect picture first. If you like it, please refer to the example code. 2. Effect 3. Code css;toolbar:false"><style> #talkbubble width: 160px; height: 80px; background: red; position: relative; border-radius: 10px; margin-left:20px; } #talkbubble:before { content: ""; position: absolute; right: 100%; top: 26px; border-top: 13px solid transparent; border-right: 26px solid red; border-bottom: 13px solid transparent; } </style> <div id="talkbubble"></div> Supplement: Pure CSS to achieve bubble dialog box sharp corner processing Let’s take a look at the effect diagram first: Simple and rough code: html: <div class="dialog-box"> <span class="bot"></span> <span class="top"></span> </div> less: .dialog-box { position: relative; span { width:0; height:0; font-size:0; overflow:hidden; position:absolute; &.bot{ border-width: 15px; border-style: solid dashed dashed; border-color: transparent transparent #F9743A transparent; left: 15px; top: -29px; } &.top{ border-width:13px; border-style:solid dashed dashed; border-color:transparent transparent #fff transparent; left:17px; top:-25px; } } } Explanation in plain language: If you want sharp corners in other directions, adjust the order of The main principle is probably to have two small triangles of the same shape but different proportions, a solid triangle bot with the same color as the background, and a top with a white background, and the top will cover the bot, and then adjust their sizes (generally speaking, the solid one should be larger than the white block, so that the edges can show the color). Finally, I tried every possible way to make them overlap (white top on top, solid bot on the bottom), and finally adjusted the absolute positioning parameters (left, top) to make them overlap seamlessly. Okay, it’s done. Do you get it? Summarize This is the end of this article about how to use CSS to achieve a small pointed corner chat dialog box with a pointed speech bubble effect. For more relevant CSS pointed corner chat dialog box content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope that everyone will support 123WORDPRESS.COM in the future! |
<<: 20 excellent foreign web page color matching cases sharing
>>: Linux service monitoring and operation and maintenance
1. Server environment configuration: 1. Check dis...
This article example shares the specific code of ...
The Flexbox layout module aims to provide a more ...
The MySQL database does not have an incremental b...
This article mainly introduces the differences be...
Since myeclipse2017 and idea2017 are installed on...
Use the following command to create a container a...
Preface I recently installed MySQL 5.7 and found ...
The cut command in Linux and Unix is used to cu...
Table of contents Overview CommonJS Specification...
Table of contents 1. Why do we need vue3? 2. Adva...
1. Review Vue responsive usage Vue responsivenes...
Preface After this blog post was published, some ...
Easy installation of opencv2: conda install --cha...
Preface In the process of managing and maintainin...