Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use CSS to realize geometric chamfering

Shulou Source: shulou.com Published: 2022-06-01 11:26:55 10月02日 Update

This article is about how to use CSS to achieve geometric chamfering. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

To achieve the effect of a corner being cut off, you can use a gradient, which accepts an angle as the direction, and allows the text to overflow and exceed the chamfer area (because it is just a background pattern), as follows:

Div {

Background: # 58a

Background: linear-gradient (- 45deg, transparent 15px, # 58a 0)

}

The effect is as follows:

Draw all kinds of geometric figures with CSS

The way to achieve two chamfering:

Div {

Width: 200px

Height: 100px

Background: # 58a

Background: linear-gradient (- 45deg, transparent 15px, # 58a 0)

Right, linear-gradient (45deg, transparent 15px, # 65a

0) left

Background-size: 50% 100%

Background-repeat: no-repeat

}

The effect is as follows:

Thank you for reading! On "how to use CSS to achieve geometric chamfering" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

Tags: Chamfer geometry geometry graphics effects content more articles good practical two methods areas just patterns text articles directions look knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker OPPO Reno Xiaomi vpn MySQL