Html 不影响文本的背景图像不透明度
我的背景图像和文本有问题。我只想应用不透明的背景图像,但我的,文本受到影响 HTMLHtml 不影响文本的背景图像不透明度,html,css,background-image,opacity,Html,Css,Background Image,Opacity,我的背景图像和文本有问题。我只想应用不透明的背景图像,但我的,文本受到影响 HTML 没有“背景不透明度”属性,但可以使用“伪元素”对其进行伪造: .content { position: relative; } .content::after { content: ""; background: url(../img/103_n.jpg) left top no-repeat, url(../img/103_n.jpg) right bottom no-repeat; opa
没有“背景不透明度”属性,但可以使用“伪元素”对其进行伪造:
.content {
position: relative;
}
.content::after {
content: "";
background: url(../img/103_n.jpg) left top no-repeat, url(../img/103_n.jpg) right bottom no-repeat;
opacity: 0.5;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
z-index: -1;
}
没有“背景不透明度”属性,但可以使用“伪元素”对其进行伪造:
.content {
position: relative;
}
.content::after {
content: "";
background: url(../img/103_n.jpg) left top no-repeat, url(../img/103_n.jpg) right bottom no-repeat;
opacity: 0.5;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
z-index: -1;
}
点击这个链接
.content{
位置:相对位置;
}
.内容::之后{
内容:“;
背景:url('https://images.pexels.com/photos/259915/pexels-photo-259915.jpeg“)左上角不重复,url('https://images.pexels.com/photos/259915/pexels-photo-259915.jpeg右下角不重复;
不透明度:0.5;
排名:0;
左:0;
底部:0;
右:0;
位置:绝对位置;
z指数:-1;
}
知识是一种美德,是一种美德,是一种美德,是一种美德
点击此链接
.content{
位置:相对位置;
}
.内容::之后{
内容:“;
背景:url('https://images.pexels.com/photos/259915/pexels-photo-259915.jpeg“)左上角不重复,url('https://images.pexels.com/photos/259915/pexels-photo-259915.jpeg右下角不重复;
不透明度:0.5;
排名:0;
左:0;
底部:0;
右:0;
位置:绝对位置;
z指数:-1;
}
知识是一种美德,是一种美德,是一种美德,是一种美德
您可以使用before(或)after并设置不透明度
.content {
position: relative;
}
.content ::after {
content: "";
position: absolute;
background:#000 \also give any color for background;
opacity: 0.5;
top: 0;
left: 0;
bottom: 0;
right: 0;
width:100%;
height:100%;
}
可以使用before(或)after并设置不透明度
.content {
position: relative;
}
.content ::after {
content: "";
position: absolute;
background:#000 \also give any color for background;
opacity: 0.5;
top: 0;
left: 0;
bottom: 0;
right: 0;
width:100%;
height:100%;
}
为了能够将父级不透明度与其子级分开,需要为父级使用伪选择器:
.content:after {
content: '';
background: url(../img/103_n.jpg) no-repeat, url(../img/103_n.jpg) right bottom no-repeat;
opacity: 0.5;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
为了能够将父级不透明度与其子级分开,需要为父级使用伪选择器:
.content:after {
content: '';
background: url(../img/103_n.jpg) no-repeat, url(../img/103_n.jpg) right bottom no-repeat;
opacity: 0.5;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
您是否尝试过将内容的z索引设置为-1,然后将文本的z索引设置为1,使您的文本位置相对。@Laljitadani您附加的链接使用的是
背景色
,我不需要让我的背景编辑opacity@Ven2.使用定位。您是否尝试过将内容的z索引设置为-1,然后将文本的z索引设置为1,使文本的位置相对。@LaljiTadhani您附加的链接使用的是背景色
,我不需要让我的背景编辑opacity@Ven2.使用定位。您应该投票关闭duplicate@Hien阮:谢谢,它运行得很好。你应该投票关闭它duplicate@Hien阮:谢谢,很好用。