UIkit2:设置背景视差有时会覆盖背景尺寸样式

时间:2019-11-29 13:25:39

标签: css uikit parallax

因此,根据https://getuikit.com/v2/docs/parallax.html,我通过

设置视差背景
<div class="para" data-uk-parallax="{bgp: 'x,100'}">...</div> //"x" means I am testing different value here
<style>.para{background-size:cover}</div>

我发现,当“ x”小于特定数字时,UIkit会使用内联样式将background-size设置为特定数字

enter image description here

上图是当我将“ x”设置为33时,可以看到background-size已设置为固定数字。下图显示了当“ x”为34时,background-size设置为auto

enter image description here

这似乎与图像的大小和父元素的大小有关。我尝试使用其他尺寸的图像,x的阈值数不同。

我可以使用“ background-size:cover!important”覆盖这种内联样式,但是我很好奇UIkit为什么会允许这种行为,还有其他方法可以克服吗?

0 个答案:

没有答案
相关问题