【发布时间】:2015-04-21 22:07:15
【问题描述】:
我正在创建一个单页 WordPress 主题。每个部分都有一个带有图像和叠加层的标题。
标题有一个背景,里面有一个换行宽度的图像。在它的底部,有一个png-image,它是半透明的,应该是全角的,覆盖在标题图像上。
由于我对这些部分使用了不同的样式,因此我对它们进行了编号,并且每个部分的叠加图像具有不同的颜色。所以我应该通过 CSS 插入它。
到现在为止,当我输入一个高度值时,我只是可以让叠加层可见。但由于页面需要响应,我希望高度是可变的,并且始终是 100% 宽度。
我的代码:
<?php query_posts('post_type=page&order=ASC'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="content" class=" section-<?php echo $i++; ?>">
<h2 class="headline"><?php the_field('headline') ?></h2>
<div class="header">
<div class="wrap cf">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('bones-thumb-600');
}
else {
}
?>
</div>
<div class="overlay"></div>
</div>
<div id="inner-content" class="wrap cf">
<div id="main" class="m-all">
<div class="stripes"></div>
<!-- Thumbnail -->
<a class="logo" href="#top"><img src="<?php echo get_template_directory_uri(); ?>/library/images/logo.png" /></a>
<div class="sidebar">
<?php the_field('sidebar') ?>
</div>
<div class="main-content"><?php the_content(); ?></div>
<img src="<?php echo get_template_directory_uri(); ?>/library/images/separator.svg"/>
</div>
</div>
【问题讨论】: