Why background-repeat: no-repeat doesn't work

2019-03-01 11:30发布

问题:

I got stuck with a strange problem in Opera 12: I have an .svg image which is linked within my css code. When I resize to zoom-out the page where the image is displayed, Opera repeats the image as if I didn't use the "no-repeat" value in background-repeat. What am I missing?

Here is my css code:

.svgImg {
    background: url("../img/img.svg") no-repeat;
    height:100%;
    width:100%;
}

I also tried this:

.svgImg {
     background: url("../img/img.svg");
     background-repeat:no-repeat;
     height:100%;
     width:100%;
 } 

But it didn't work. Why opera does that?

回答1:

.svgImg {
background: url("../img/img.svg") no-repeat;
height:100%;
width:100%;
}