早上好,我需要复制这个形状,但我不知道如何正确地再现蓝色背景。你知不知道?这个绝对位置不适合我,因为它是一个反应灵敏的图像。对于图像,我使用了旋转属性:
.content {
display: flex;
.image {
flex: 0 0 50%;
img {
transform: rotate(85deg);
}
@include media-screen-lg {
padding-left: 24px;
padding-right: 0;
}
}
<div class="content">
<div class="text"></div>
<div class="image">
<img src={{content.field_image}}>
</div>
</div>
发布于 2022-09-29 04:49:39
对于单个子/容器,可以使用width
、background
和rotate
,例如:
.image {
background: blue;
width: max-content;/*shrinks to image's width */
margin: 3em;
}
img {
rotate: 5deg
}
<div class="image">
<img src="https://dummyimage.com/520x550">
</div>
发布于 2022-09-29 04:54:12
只需使用psuedo元素,如下所示:
.image::before {
background-color: blue;
content: '';
display: flex;
inset: 0 0 0 0;
position: absolute;
}
https://stackoverflow.com/questions/73895677
复制