Visitar URL original
第 4 期(2019-05-11):CSS 菱形剪切 · Issue #6 · fezaoduke/fe-practice-hard · GitHub
Skip to content

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

Description

@wingmeng

来源:原创题
难度:★

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

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

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

参考效果图:

image


本期优秀回答者: @liwenkang

Activity

  1. liwenkang commented on May 11, 2019

    @liwenkang
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions