我可以在简单的 html/css 中做一些事情,将其设置为黑色背景并在其前面有一个白色居中,如下所示:
<html>
<head>
<style>
body
{
background-color:#000;
}
#div1
{
margin-left:auto;
margin-right:auto;
width:90%;
background-color:#eeeeee;
}
#bannerImg
{
width:100%;
display:block;
margin-left:auto;
margin-right:auto;
}
</style>
</head>
<body>
<div id="div1">
<img id="bannerImg" src="brav-banner-3.jpg">
<p>This is some text.
<p> And some more.
<p> And some more.
</div>
</body>
但是当我在 WordPress 中使用 BlankSlate 主题尝试同样的事情时,我无法显示任何白色。这里是 header.php、front-page.php 和 style.css。
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
....
</head>
<body <?php body_class(); ?>>
<div id="wrapper" class="hfeed">
<header id="header" role="banner">
<img src="<?php get_template_directory()?>/assets/img/brav-banner-3.jpg">
<div id="navDiv"><nav id="menu" role="navigation">
<?php wp_nav_menu( array( 'theme_location' => 'main-menu' ) ); ?>
</nav></div>
</header>
<div id="container">
前端页面.php:
<?php get_header(); ?>
<section id="content" role="main">
<div id="info">
<h4>In the Los Angeles area? </h4> <p>Ask about free demo loaners! </p>
<h4>We also take mail orders.</h4> On all orders, there is a 30-day return policy!</p>
</div>
<div id="longSlogan">
<img class="frontpageimg" src="<?php get_template_directory(); ?>/assets/img/slogan-2.jpg">
</div>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
样式.css:
#header {
margin-left: auto;
margin-right: auto;
width:90%;
}
body {
background: #000;
}
#longSlogan {
margin-left: 20px;
}
#container {
clear:both;
backgroud-color:#fff;
}
nav {
display:block;
overflow:hidden;
width: 100%;
background-color: #222222;
}