Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 使用knockout设置背景图像:适用于chrome,但不适用于其他浏览器_Css_Google Chrome_Knockout.js - Fatal编程技术网

Css 使用knockout设置背景图像:适用于chrome,但不适用于其他浏览器

Css 使用knockout设置背景图像:适用于chrome,但不适用于其他浏览器,css,google-chrome,knockout.js,Css,Google Chrome,Knockout.js,我使用knockout在一些div上设置背景图像: <div class="values" data-bind="foreach: values" > <div class="cvsection" data-bind="style: {'background-image': backgroundimg}" style="background-repeat: no-repeat; background-size:100%;background-repeat: no-repea

我使用knockout在一些div上设置背景图像:

<div class="values" data-bind="foreach: values" >
  <div class="cvsection" data-bind="style: {'background-image': backgroundimg}" style="background-repeat: no-repeat; background-size:100%;background-repeat: no-repeat; background-position: center bottom;">

    <!-- Stuff inside the div -->   
  </div>
</div>
背景图像在Chrome和IE9中的显示与预期一致,但在Firefox 15或IE8中却没有。我在控制台中没有看到任何javascript错误或任何东西


你认为这是击倒的问题,还是其他CSS问题?任何帮助都将不胜感激

我想你的片段应该是

<div class="values" data-bind="foreach: values" >
  <div class="cvsection" data-bind="style: {backgroundImage: backgroundimg}" style="background-repeat: no-repeat; background-size:100%;background-repeat: no-repeat; background-position: center bottom;">

    <!-- Stuff inside the div -->   
  </div>
</div>

“背景图像”已更改为backgroundImage

根据:

如果要应用字体大小或文字装饰样式,或 名称不是合法JavaScript标识符的其他样式(例如。, 因为它包含一个连字符),所以必须使用 那种风格

看看,当它说:

注意:应用名称不是合法JavaScript变量名的样式

如果要应用字体大小或文字装饰样式,或 名称不是合法JavaScript标识符的其他样式(例如。, 因为它包含一个连字符),所以必须使用 那种风格。比如说,

不要写{font-weight:someValue};写{fontWeight: someValue}

不要写{文本装饰:someValue};写{textEncoration: someValue}

因此,如果你想应用css规则“背景图像”,你必须在敲除的样式绑定中写“背景图像”

医生总是做这件事;)

你能做一个演示吗?
<div class="values" data-bind="foreach: values" >
  <div class="cvsection" data-bind="style: {backgroundImage: backgroundimg}" style="background-repeat: no-repeat; background-size:100%;background-repeat: no-repeat; background-position: center bottom;">

    <!-- Stuff inside the div -->   
  </div>
</div>