For the realization of digital addition and subtraction button, many schemes have been used before, such as:
1. Use background image – this effect is better, but the disadvantage is that the style control is a little complicated, and pictures are needed;
2. Directly using “+” – “- this method is simple and crude and easy to implement. The disadvantage is that the display is slightly different in different browser environments, and the line thickness of symbol size machine is not easy to adjust;
3. The use of Unicode characters is almost the same as method 2, and the compatibility is not good. Some mobile phones do not display the characters;
4. use CSS style, use tags to generate horizontal and vertical positioning of absolute positioning, and then adjust their location to synthesize the plus sign. The disadvantage is that different browsers may have a slight mismatch in horizontal and vertical collocation. In this case, the label can be used to generate two identical horizontal lines, and then one of them is rotated by 90 degrees, which will achieve better results;
For the above, it can be said that the best is the first use of pictures, although it is a bit troublesome, but the effect is the best, do not worry about compatibility, the other is not recommended to use.
Recently found a new method, is to use CSS3
background-image Style with linear gradient
linear-gradient Synthesis plus sign, the specific implementation is as follows.
Among them, the key styles are bold at both ends. After verification, the compatibility of this method is relatively good, which can be said to be the same as H5 / CSS3 compatibility.
It can be said that this is the simplest way to realize it. I admire the man who thought of this usage.
The above is the best scheme of pure CSS to realize the digital addition and subtraction button. I hope it will be helpful to you. If you have any questions, please leave me a message, and the editor will reply to you in time. Thank you very much for your support to the developeppaer website!
If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!