我似乎无法在WordPress的整个页面的背景中显示单个图像,其中包括标题,导航栏和主要内容页面。
对于此网站:LHollywood
使用Morone的Simone的单页登陆儿童主题。
我可以使用WordPress仪表板在实际页面上插入div class="image"
,并且在文本框后面的导航栏下方显示没有问题("拉丁好莱坞是......&# 34;)。
但我也希望将图片放在标题的背景中。
CSS :
.image {
width: 100%;
height: 36em;
display: block;
background: url("http://sheiler.info/latin/wp-content/uploads/2014/08/latinh-logo.png") no-repeat center center;
background-size: cover;
overflow: visible;
}
我尝试过的并没有奏效,同时保持名称.image
,以便我不必更改css:
在 header.php 文件中添加了<div class="image">
。
注意:header.php中的原始编码不会关闭 -
div id =&#34;内容&#34;类=&#34;位点含量&#34;&GT;
像这样:
body <?php body_class(); ?>>
div id="page" class="hfeed site">
div class="image">
header id="masthead" class="site-header" role="banner">
a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'simone' ); ?></a>
<?php if ( get_header_image() && ('blank' == get_header_textcolor()) ) { ?>
<figure class="header-image">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
</a>
</figure>
等...
home.page.page-id-16.page-template-default {
background: url("images/latinh-logo.png") no-repeat center center;
}
我还将类ID添加到其他现有的div中,但没有运气。
答案 0 :(得分:0)
使用此代码:
body {
background: url("http://sheiler.info/latin/wp-content/uploads/2014/08/latinh-logo.png") no-repeat 50% !important;
background-size: cover;
}
请确保没有任何背景重叠的元素(我可以看到你的标题有一个带背景的.site-branding类,可能还有更多)