Cᴏʀ*_*ᴏʀʏ 11
<html>
<head>
<style type="text/css">
body {
text-align: center; /* Center in IE */
}
#content {
text-align: left; /* reset text-align for IE */
margin: 0 auto; /* Center in other browsers */
width: 800px;
}
html {
overflow: -moz-scrollbars-vertical; /* Force vertical scrollbar in FF */
}
</head>
<body>
<div id="content">
content here
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
*更新:根据下面的一些评论,我添加了一些强制FF垂直滚动条的CSS.
#wrapper {
width: 800px;
margin: 0 auto;
}
<div id="wrapper">
<p>This will appear in a centered container</p>
</div>
Run Code Online (Sandbox Code Playgroud)