我正在HTML5中创建一个网页。我使用的是基本页脚,但页脚的背景颜色并没有延伸到页面边框。它周围有一个黄色边框,即使我给它明显的边缘。你们能告诉我如何修复我的页脚边缘,以便没有黄色,只有白色吗?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>San Joaquin Valley Town Hall</title>
<link rel="shortcut icon" href="../images/favicon.ico">
<link rel="stylesheet" href="../styles/normalize.css">
<link rel="stylesheet" href="../styles/c05x_sorkin.css">
<style>
body {
background-color: yellow;
font-size: default;
border: 10px double blue;
width: 650px;
margin-left: auto;
margin-right: auto;
margin-bottom: 40px;
padding-bottom: 0px;
}
img {
float: left;
margin: 20px;
}
main {
text-align: left;
background-color: white;
padding-left: 30px;
padding-right:30px;
padding-top: 12px;
padding-bottom: 0px;
}
h1 {
color: blue;
font-size: 150%;
}
h2 {
font-size: 125%;
margin-bottom: 5px;
}
h3 {
font-size: 115%;
margin-bottom: 0px;
}
blockquote {
margin: 0px;
}
ul{
margin-left: 0px;
padding-left: 20px;
}
li {
margin-left: 0px;
margin-top: 0px;
}
p.citation {
text-align: right;
margin-bottom: .75em;
}
cite{
color: blue;
font-style: normal;
}
footer {
text-align: center;
border-top: 3.5px solid blue;
margin-right: 20px;
margin-left: 20px;
padding-top: 0px;
background-color: white;
font-weight: bold;
font-size: 90%
}
</style>
</head>
<body>
<main>
<h1>Andrew Ross Sorkin, author of <i>Too Big to Fail</i></h1>
<h3>November 2015</h3>
<img src="../images/sorkin_desk260.jpg" alt="Andrew Ross Sorkin" width="260">
<p>New York Times columnist and author, Andrew Ross Sorkin, has been described as <q>the most famous financial journalist of his generation.</q> A leading voice on Wall Street and corporate America, his New York Times bestseller, <i>Too Big to Fail</i>, was the first true, behind-the-scenes, moment-by-moment account of how that financial crisis developed into a global tsunami.</p>
<p>The Economist, The Financial Times, and Business Week all named <i>Too Big To Fail</i> one of the best books of the year. The book was published by Viking October 20, 2009. The book was adapted as a movie by HBO Films and premiered on HBO on May 23, 2011. The film was directed by Curtis Hanson, and the screenplay was written by Peter Gould.</p>
<h2>Praise for <i>Too Big to Fail</i></h2>
<blockquote>“Vigorously reported, superbly organized...for those of us who didn't pursue MBAs and have the penny-ante salaries to prove it.”</blockquote>
<p class="citation"><cite>Julia Keller, Chicago Tribune</cite></p>
<blockquote>“Sorkin's prodigious reporting and lively writing put the reader in the room for some of the biggest-dollar conference calls in history. It's an entertaining, brisk book.”</blockquote>
<p class= "citation"><cite>Paul M. Barrett, The New York Times Book Review</cite></p>
<h2>The cast of the movie: <i>Too Big to Fail</i></h2>
<ul>
<li>William Hurt as Hank Paulson</li>
<li>Paul Giamatti as Ben Bernanke</li>
<li>Billy Crudup as Timothy Geithner</li>
<li>Edward Asner as Warren Buffet</li>
</ul>
</main>
<footer>
<p>Prepared by: Alisha Matreja</p>
<p>Date: November 8th, 2015</p>
</footer>
</body>
</html>
答案 0 :(得分:1)
我相信你会选择这个结果https://jsfiddle.net/8Lfttr01/
从margin-left
css中取出margin-right
和.footer
答案 1 :(得分:0)
您的CSS中只需要更改几行:
<强> 1。变化强>
footer {
text-align: center;
border-top: 3.5px solid blue;
margin-right: 20px;
margin-left: 20px;
padding-top: 0px;
background-color: white;
font-weight: bold;
font-size: 90%
}
到
footer {
text-align: center;
border-top: 3.5px solid blue;
margin: 0 auto;
padding-top: 0px;
background-color: white;
font-weight: bold;
font-size: 90%
}
<强> 2。变化强>
ul {
margin-left: 0px;
padding-left: 20px;
}
到
ul {
margin: 0;
padding: 0 0 12px 20px;
}
第3。添加强>
footer p:last-of-type {
margin-bottom: 0;
padding-bottom: 12px;
}