内联css背景大小封面

内联css背景大小封面,css,Css,我有下面的css代码 .imgf{ background: url(/thatscooking/FotoTC/FotoTC/ALWIN01.JPG) no-repeat center center ; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } 现在我需要用php更改im

我有下面的css代码

.imgf{
    background: url(/thatscooking/FotoTC/FotoTC/ALWIN01.JPG) no-repeat center center ; 
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}
现在我需要用php更改img,所以我尝试使用内联css

 <div style="background: url(/thatscooking/FotoTC/FotoTC/ALWIN01.JPG) no-repeat center center" 
    style="background-size: cover"
    style="-webkit-background-size: cover" 
    style="-moz-background-size: cover" 
    style="-o-background-size: cover" 
    class="imgf ">
<div id="naamb"><p>Album Naam</p></div></div>

专辑Naam

只是现在背景尺寸的封面不起作用,也没有出现在firebug中


我是否使用了内联css错误?

您需要使用单
样式
标记

<div style="background: url(/thatscooking/FotoTC/FotoTC/ALWIN01.JPG) no-repeat center center;
            background-size: cover;
            -webkit-background-size: cover;
            -moz-background-size: cover; 
            -o-background-size: cover;" 
    class="imgf ">
<div id="naamb"><p>Album Naam</p></div></div>

专辑Naam


使用比@RAS版本更干净的代码:

background: url(image.jpg) no-repeat center center / cover;

不应在元素样式中使用。使用cssI我使用它是为了能够用php更改它