【发布时间】:2021-02-08 12:47:15
【问题描述】:
我想创建一个这样的 css 形状(我不知道该形状的名称),并为其添加背景图像。你们能帮帮我吗?
这是形状:
.figure{
width: 180px;
height: 180px;
border: 1px solid #32557f;
border-radius: 0 50% 0% 50%;
transform: rotate(45deg);
bottom: -50px;
position: relative;
left: 17px
}
<div class="figure"></div>
如果我附加背景图片,它也会受到旋转的影响。
.figure{
width: 180px;
height: 180px;
border: 1px solid #32557f;
border-radius: 0 50% 0% 50%;
transform: rotate(45deg);
background-size: 100%;
background-image:url('https://images.unsplash.com/photo-1593642634315-48f5414c3ad9');
background-repeat:no-repeat;
bottom: -50px;
position: relative;
left: 17px
}
<div class="figure"></div>
好的,我当前的解决方案如下所示:
.figure {
width: 180px;
height: 180px;
border: 1px solid #32557f;
border-radius: 0 50% 0% 50%;
transform: rotate(45deg);
bottom: -50px;
position: relative;
left: 17px;
overflow: hidden;
}
.test{
background-image: url(https://images.unsplash.com/photo-1602000750546-f8e331a082d1);
transform: rotate(-45deg);
height: 145%;
width: 142%;
background-size: cover;
background-repeat: no-repeat;
background-size: 100%;
position: fixed;
top: -43px;
right: -44px;
}
<div class="figure">
<div class="test"></div>
</div>
有人知道如何调用这个 CSS 形状吗?
谢谢!
【问题讨论】:
-
我认为我们应该假设在 Paint 中翻转图像在这里不是一个选项:)
标签: html css css-shapes