【发布时间】:2018-06-03 03:27:22
【问题描述】:
我有这个用于 wordpress 主题的自定义页面模板的代码。背景图像不是作为背景,而是像普通图像一样被放置在内容下方。我已经尝试了以下链接中提到的所有内容,但没有任何效果How to place background image behind page content?
<?php /* Template Name: Kunst Page */ ?>
<html>
<head>
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
/* The image used */
background-image: url("http://www.caa-design.ch/wp-
content/uploads/2017/12/ohne-titel-modifiziert.jpg");
/* Full height */
height: 100%;
/* Center and scale the image */
background-position: absolute;
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body>
<div id="primary" class="content-area one column">
<main id="main" class="site-main" role="main">
<?php
while ( have_posts() ) : the_post();
the_content();
endwhile;
?>
<div class="bg"></div>
</body>
</html>
【问题讨论】: