During the development activity, I encountered a very simple text bubble effect, which is roughly like this. Emmmm, it looks simple. The implementation idea is as follows
It's basically not difficult and can be done in minutes. until... Product: Oh, by the way, this bubble chart will be made configurable in the background later. Then we can just upload the picture, which will be regarded as the user’s personal signature. I:! ! ! (╯‵□′)╯︵┻━┻ This is a bit embarrassing. You can’t have a before picture and an after picture for the product and write the gradient in between yourself. I guess I'll be hacked to death in any minute. In the early years at work, I heard an Android colleague talk about something called .9png, so I searched online to see if the front end could achieve a similar effect. Sure enough, I found it. .9png What is .9png? .9png is an image format on Android, specifically used for bubble effects. Its characteristic is that it divides a picture into 9 parts, and the four corner areas will not be stretched. Only the middle part will be stretched. In this way, even if your content area expands, the elements retained in the corners will not be deformed. Front-end implementation Smart students can directly click here to see the effect https://codepen.io/gong12339/pen/PowxmzL The following attributes are needed to implement .9png on the front end. The officially recommended .9png image resolution is 81 * 81, so each of the 9 cut areas is 27 * 27 in width and height. Because my piece is a rectangle, I need to measure the position of the slices myself. And my picture obviously does not support vertical stretching .border { border-width: 18px 44px 25px 28px; border-style: solid; border-image-source:url(https://raw.githubusercontent.com/gong12339/vic-blog/master/static/img/border.9.png); border-image-slice:25 44 25 28 fill; border-image-width:25px 44px 25px 28px; }
Here we will focus on At this point we have basically completed the configuration The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Advantages of MySQL covering indexes
>>: Analyze the problem of Zabbix 5.0 disk automatic discovery and read-write monitoring
Preface The previous article installed Hadoop, an...
Preface I wrote a small demo today. There is a pa...
There are some tags in XHTML that have similar fu...
This article example shares the specific code of ...
Equal height layout Refers to the layout of child...
Before officially using Docker, let's first f...
Table of contents npm download step (1) Import (2...
Preface Although some love in this world has a pr...
This article uses examples to describe the three ...
These introduced HTML tags do not necessarily ful...
Table of contents Brief description: 1. Four char...
introduce This chapter mainly introduces the proc...
When we write code, we often need to know the dif...
Preface We often say that node is not a new progr...
Table of contents Preface LED Trigger Start explo...