我最初有较小的三角形,但希望它们在页面上更大,所以我在前景中的三角形中添加了一些填充。当我这样做时,它切断了我的一些三角形,我无法弄清楚如何在不牺牲尺寸的情况下将其添加回去。我尝试了高度和宽度,而那些人什么都不做。
.triangle-background {
width: 375px;
/*width of triangle picture background*/
padding-bottom: 325px;
position: relative;
overflow: hidden;
transform-origin: 0 100%;
transform: rotate(7deg);
}
.triangle-background:before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background-image: linear-gradient(rgba(229, 227, 228, 0.85), rgba(229, 227, 228, 0.85)), url("/images/apartments.jpeg");
background-size: cover;
background-position: center top;
transform-origin: 0 100%;
transform: rotate(60deg) skewX(30deg);
}
.triangle-foreground {
position: absolute;
top: 110px;
left: 98px;
border-style: solid;
border-width: 0px 170px 280.8px 170px;
border-color: transparent transparent #85FDF3 transparent;
transform: rotate(50deg);
filter: drop-shadow(1px 1px 2px #BBB);
padding-left: 20px;
padding-top: 40px;
}

<div class="triangle-background"></div>
<div class="triangle-foreground"></div>
&#13;
任何帮助都会很棒!
答案 0 :(得分:1)
要增加尺寸,您可以像我在这里一样更改边框宽度,从0px 170px 280.8px 170px;
更改为0px 190px 300.8px 190px
.triangle-background {
width: 375px;
/*width of triangle picture background*/
padding-bottom: 325px;
position: relative;
overflow: hidden;
transform-origin: 0 100%;
transform: rotate(7deg);
}
.triangle-background:before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background-image: linear-gradient(rgba(229, 227, 228, 0.85), rgba(229, 227, 228, 0.85)), url("/images/apartments.jpeg");
background-size: cover;
background-position: center top;
transform-origin: 0 100%;
transform: rotate(60deg) skewX(30deg);
}
.triangle-foreground {
position: absolute;
top: 110px;
left: 98px;
border-style: solid;
border-width: 0px 190px 300.8px 190px;
border-color: transparent transparent #85FDF3 transparent;
transform: rotate(50deg);
filter: drop-shadow(1px 1px 2px #BBB);
}
&#13;
<div class="triangle-background"></div>
<div class="triangle-foreground"></div>
&#13;