
直接上代码咯。
<!DOCtype html> <HTML lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-eqUIv="X-UA-Compatible" content="IE=Edge"> <title>菱形的图形</title> <style> img{ vertical-align: top; } .picture{ width: 300px; margin: 5em; border: 1px solid #000; transform: rotate(45deg); overflow: hidden; } .picture > img { max-width: 100%; transFORM: rotate(-45deg) scale(1.42); } .picture2 img { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); transition: 1s clIP-path; } .picture2 img:hover { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); } </style> </head> <body> <div class="picture"> <img src="/demo/cat.jpg" alt="..."> </div> <div class="picture2"> <img src="/demo/cat.jpg" alt="..."> </div> </body> </html>








网友评论文明上网理性发言 已有0人参与
发表评论: