简体   繁体   English

我在 Wordpress 中通过 CSS 添加了“背景图像” 二十七:不显示

[英]I added "background-image" via CSS in Wordpress twenty-seventeen: doesn't display

I want to override Wordpress's Twenty-Seventeen header image by adding my own background-image via CSS.我想通过 CSS 添加我自己的背景图像来覆盖 Wordpress 的 27 岁标题图像。 However, it just displays blank white... Here's the body's html:但是,它只显示空白...这是正文的 html:

<body class="page-template-default page page-id-5 logged-in wp-custom-logo has-header-image page-one-column title-tagline-hidden colors-light page-soins" data-aos-easing="ease" data-aos-duration="400" data-aos-delay="0" cz-shortcut-listen="true">

and here's my CSS to disable wordpress's header image:这是我的 CSS 来禁用 wordpress 的标题图片:

.page-soins .wp-custom-header {
     display: none;
}

and here's my CSS to add my background image instead:这是我的CSS来添加我的背景图片:

body.page-soins {
    background: url("images/backgrounds/soins-bg-1.jpg") no-repeat center center fixed;
    background-size: cover;
}

Finally, here's the link to the page: http://latelierdegaia.ch/soins最后,这是页面的链接:http: http://latelierdegaia.ch/soins

Can anyone help?任何人都可以帮忙吗?

.site-content-contain

and

.site-mast-head

both have都有

background-color: #fff;

which covers your background-image .它涵盖了您的background-image

I found a workaround that works around!我找到了一种解决方法! But does the trick.但确实有效。 I just added the CSS background-image to the "site-header" class instead of the "body".我只是将 CSS 背景图像添加到“站点标题”类而不是“正文”。

body.page-soins .site-header {
    background: url("images/backgrounds/soins-bg-1.jpg") no-repeat center center fixed;
    background-size: cover;
}

You just have to remove background-color: #fafafa;你只需要删除background-color: #fafafa; from your .site-header class.从你的.site-header类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM