我可以用简单的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">
前page.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(); ?>
的style.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;
}