CSS code to achieve coupon edge punch

Source: Internet
Author: User
The project used this edge punch effect, try to use the pure CSS to write this style, this article mainly to share the use of pure CSS to write an edge punch effect, the need for a friend reference, hope to help everyone.

The effect is roughly

Steps to achieve the idea of:

1, first draw two boxes with rounded corners, A and B (a, b respectively need to add a projection effect, not on the diagram)

2, in the left and right of B two gaps to draw a row of circles (in fact, the square with 50% of the fillet), the circle fill color and the background color is the same (here the background color is white, so the round fill is white)

3, to the round hole plus inner shadow, to achieve the real punch effect, here is used in this CSS:

box-shadow:0 1px 1px rgba (0,0,0,0.2) inset;

4, at this time B to the right of a row of holes due to the addition of the inner shadow of the relationship, appears to be more right half, here need to deal with the surplus parts

Then use a piece and the background color (here is white) the same block block the right side of the extra half of the hole (that is, Area C, in order to see here with a different color, adjusted to the background color is the beginning of the same)

Note: The width of a and B can be adaptive (for example, how much of the outer layer), and the height of a and B must be written dead due to the number and position of the punch.

The specific implementation code is as follows:

<! DOCTYPE html> 

Real-world results for specific code implementations:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.