A recommended method for resetting CSS styles is using the Eric Meyer reset, which is considered one of the best ways to do it rather than relying on the universal selector *
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>North Carolina Golf Car Dealers</title>
<style type="text/css">
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#container {
width: 960px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>Header goes here.</h1>
</div>
<div id="content">
<p>Content goes here</p>
</div>
<div id="footer">
<p>Footer goes here.</p>
</div>
</div>
</body>
</html>
It's recommended to separate HTML and CSS by using an external style sheet:
For example, in index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>North Carolina Golf Car Dealers</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="container">
<div id="header">
<h1>Header goes here.</h1>
</div>
<div id="content">
<p>Content goes here</p>
</div>
<div id="footer">
<p>Footer goes here.</p>
</div>
</div>
</body>
</html>
And in style.css:
@charset "utf-8";
/* CSS Document */
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#container {
width: 960px;
margin: 0 auto;
}
Note: The CSS #container was updated from:
#container {
width: 960px;
margin-right: auto;
margin-left: auto
to:
#container {
width: 960px;
margin: 0 auto;
}
Both methods work effectively for centering the container.