简体   繁体   English

添加background-image:no-repeat后背景消失了;

[英]background disappearing after adding background-image:no-repeat;

I am trying to set a background image for my wordpress website. 我正在尝试为我的wordpress网站设置背景图片。

.content:before {
content: "";
background-image: url("gfx/SevenWonders.jpg");
/*background: #fff;*/
background-size:600px 700px;
background-repeat: no-repeat;
position: absolute;
z-index: -9999;
top: 0;
right: 28.5%;
bottom: 0;
left: -10000px;
}

this is my css code with background-image. 这是我的带有背景图像的CSS代码。 I resized the size because the image 我调整了尺寸,因为图片

is pretty large for my website. 对于我的网站来说很大。 AND! 和! after adding background-repeat: no-repeat, 添加背景重复:不重复之后,

the background is not displayable. 背景不可显示。 I see only white background. 我只看到白色背景。

Of course, I googled to find the solutions, but almost all of them are saying 当然,我用谷歌搜索找到了解决方案,但是几乎所有人都在说

about syntax error, but I cannot find any syntax mistakes in my code .. 关于语法错误,但是我在代码中找不到任何语法错误..

check this fiddle. 检查这个小提琴。 Problem is with your left property value in css. 问题是您在CSS中的left属性值。

.content:before {
content: "";
background-image: url("https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=350&h=150");
/*background: #fff;*/
background-size:600px 700px;
background-repeat: no-repeat;
position: absolute;
z-index: -9999;
top: 0;
right: 28.5%;
bottom: 0;
left: 0px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM