包含在背景大小下不起作用的值
Contain value not working in background size
这道题和另一道题很像,但不完全相同的是代码没有后台快捷代码,而是使用了个别规则。
关于图层的注释
第 1 层是由 PHP 创建的内联样式
第 2 层是我尝试在不覆盖 PHP 的情况下将包含值添加到子主题中的层。
第 3 层是父主题,将覆盖值分配给该层。在 Firefox Inspector 中,背景大小规则显示为被划掉。
第 4 层也是父主题的一部分。
element
{
background-image: url(https://montanawebmaster.com/wp-content/uploads/2018/11/Bug.jpg);
}
#masthead .header-image
{
background-size: contain;
}
#masthead .header-image
{
display: block;
width: inherit;
max-width: 100%;
margin: 0 auto;
background-size: cover;
background-position: 50% 50%;
background-attachment: fixed;
}
.kahuna-cropped-headerimage div.header-image
{
height: 100%;
}
这影响了几个使用父主题的网站,但这里有一个例子:https://montanawebmaster.com/images/why-is-the-wordpress-kahuna-theme-messing-with-my-images/横幅中的错误图像应该包含而不是覆盖。
问题是background-attachment: fixed
。
您需要将 css 更新为:
#masthead .header-image {
background-repeat: no-repeat;
background-attachment: unset;
}
有了这个新变化,您可能想也可能不想将其设置回 cover
。
这道题和另一道题很像,但不完全相同的是代码没有后台快捷代码,而是使用了个别规则。
关于图层的注释 第 1 层是由 PHP 创建的内联样式 第 2 层是我尝试在不覆盖 PHP 的情况下将包含值添加到子主题中的层。 第 3 层是父主题,将覆盖值分配给该层。在 Firefox Inspector 中,背景大小规则显示为被划掉。 第 4 层也是父主题的一部分。
element
{
background-image: url(https://montanawebmaster.com/wp-content/uploads/2018/11/Bug.jpg);
}
#masthead .header-image
{
background-size: contain;
}
#masthead .header-image
{
display: block;
width: inherit;
max-width: 100%;
margin: 0 auto;
background-size: cover;
background-position: 50% 50%;
background-attachment: fixed;
}
.kahuna-cropped-headerimage div.header-image
{
height: 100%;
}
这影响了几个使用父主题的网站,但这里有一个例子:https://montanawebmaster.com/images/why-is-the-wordpress-kahuna-theme-messing-with-my-images/横幅中的错误图像应该包含而不是覆盖。
问题是background-attachment: fixed
。
您需要将 css 更新为:
#masthead .header-image {
background-repeat: no-repeat;
background-attachment: unset;
}
有了这个新变化,您可能想也可能不想将其设置回 cover
。