【发布时间】:2014-10-17 11:30:55
【问题描述】:
我似乎无法让单个图像出现在 WordPress 整个页面的背景中,包括标题、导航栏和主要内容页面。
本站:LHollywood
使用 Mor10 的 Simone 的单页登陆子主题。
我可以使用 WordPress 仪表板在实际页面上插入 div class="image",并且在导航栏下方的文本框后面(“Latin Hollywood is the ...”)看起来没有问题。
但我想让图像也出现在标题的背景中。
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<div class="image">。 注意:header.php中的原始编码并没有关闭-div id="content" class="site-content">
像这样:
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>
等等……
- 在lander-style.css中添加了这个:
home.page.page-id-16.page-template-default {
background: url("images/latinh-logo.png") no-repeat center center;
}
我还没有运气将类 ID 添加到其他现有 div。
【问题讨论】:
-
您是否尝试过背景图像与 !important 在正文上?
标签: wordpress css background-image