Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第 4 期(2019-05-11):CSS 菱形剪切 #6

Open
wingmeng opened this issue May 11, 2019 · 1 comment
Open

第 4 期(2019-05-11):CSS 菱形剪切 #6

wingmeng opened this issue May 11, 2019 · 1 comment

Comments

@wingmeng
Copy link
Collaborator

wingmeng commented May 11, 2019

来源:原创题
难度:★

使用纯 CSS 将下面的图片进行菱形剪切。

注:图片不允许拉伸、挤压。实现代码越简单越好。

<!-- html -->
<img src="https://fezaoduke.github.io/fe-practice-hard/assets/pics/cartoon.png">
/* css */
img {
  /* 你的代码 */
}

参考效果图:

image


本期优秀回答者: @liwenkang

@liwenkang
Copy link

img{
    /* polygon 中的参数是多边形的顶点 */
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants