在背景混合模式下旋转图像
rotate a image within background-blend-mode
我想知道是否可以在背景混合模式下旋转图像。
我想旋转我的第二张图片:
GLRlogo_RGB.png。我试过它来转换、翻译,但它似乎并没有那样工作。
谁能帮我解决问题?
谢谢!
这是我的代码
#main-image-3{
background-image: url(../img/layout-picture4.jpg), url(../img/GLRlogo_RGB.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover, calc(15rem + 10vw);
margin: 0 0 73rem 0;
transform: rotate(0,0,45deg);
}
#main-image-1, #main-image-2, #main-image-3{
background-color: rgba(9, 231, 9, 0.301);
background-blend-mode: screen, multiply;
}
我知道的唯一方法是将背景 属性 设置为伪元素 ::before
或 ::after
然后对其应用旋转并隐藏与overflow:hidden
喜欢
.back-rotate {
width:500px; /*it's important to have a size for the relative size of the ::before pseudo element*/
height:200px;
position:relative; /*also important, but if you don't use it, then set the ::before to 'relative' instead of 'absolute' and .back-rotate to 'static' */
overflow:hidden;
}
.back-rotate::before {
content:'';
position:absolute;
/*positioning my background relatively to the main container*/
width:200%;
height:200%;
top:-50%;
left:-50%;
/*layer position 0 so he get behind what the div contains (text etc) */
z-index:0;
/*the rotation*/
background-size:cover;
background-position:center center;
transform:rotate(45deg);
}
/* my background image */
.back-rotate::before {
background-image:url('https://helpx.adobe.com/in/stock/how-to/visual-reverse-image-search/_jcr_content/main-pars/image.img.jpg/visual-reverse-image-search-v2_1000x560.jpg');
<div class='back-rotate'></div>
我想知道是否可以在背景混合模式下旋转图像。 我想旋转我的第二张图片: GLRlogo_RGB.png。我试过它来转换、翻译,但它似乎并没有那样工作。 谁能帮我解决问题? 谢谢!
这是我的代码
#main-image-3{
background-image: url(../img/layout-picture4.jpg), url(../img/GLRlogo_RGB.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover, calc(15rem + 10vw);
margin: 0 0 73rem 0;
transform: rotate(0,0,45deg);
}
#main-image-1, #main-image-2, #main-image-3{
background-color: rgba(9, 231, 9, 0.301);
background-blend-mode: screen, multiply;
}
我知道的唯一方法是将背景 属性 设置为伪元素 ::before
或 ::after
然后对其应用旋转并隐藏与overflow:hidden
喜欢
.back-rotate {
width:500px; /*it's important to have a size for the relative size of the ::before pseudo element*/
height:200px;
position:relative; /*also important, but if you don't use it, then set the ::before to 'relative' instead of 'absolute' and .back-rotate to 'static' */
overflow:hidden;
}
.back-rotate::before {
content:'';
position:absolute;
/*positioning my background relatively to the main container*/
width:200%;
height:200%;
top:-50%;
left:-50%;
/*layer position 0 so he get behind what the div contains (text etc) */
z-index:0;
/*the rotation*/
background-size:cover;
background-position:center center;
transform:rotate(45deg);
}
/* my background image */
.back-rotate::before {
background-image:url('https://helpx.adobe.com/in/stock/how-to/visual-reverse-image-search/_jcr_content/main-pars/image.img.jpg/visual-reverse-image-search-v2_1000x560.jpg');
<div class='back-rotate'></div>