简体   繁体   中英

How to create a diagonal background effect, using CSS

Is it possible to create the effect shown in the following image, using CSS?

[此处链接的图像] [1]使用CSS?

Basically I want to create <div> s that have a background split diagonally with a block color on side and white on the other?

You can use linear-gradient on background . See the following example:

 body { height:100vh; width:100vw; background:linear-gradient(160deg, red, red 60%, white 60%, white); } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM