我正在处理一个网页,我设置了 div 标签的宽度,并且正在使用 margin: 0 auto; 但我的内容仍然在左边。我正在使用 OS X 10.7.3、Chrome 19.0.1084.46 和 Dreamweaver CS6
这是我的CSS:
@charset "UTF-8";
body {
text-align: center;
display: block;
}
.container {
float: left;
height: 2000px;
width: 964px;
margin: 0 auto;
text-align: left;
}
.header {
float: left;
height: 117px;
width: 964px;
}
.leftcol {
float: left;
height: 1715px;
width: 534px;
margin-top: 20px;
margin-right: 10.125px;
margin-bottom: 20px;
margin-left: 30px;
}
.navbar {
float: left;
height: 69px;
width: 964px;
}
.rightcol {
float: left;
height: 1715px;
width: 306px;
margin-top: 20px;
margin-bottom: 0px;
margin-left: 20.25px;
}
.video {
float: left;
height: 301px;
width: 534px;
}
.pagebody {
float: left;
height: 1749px;
width: 920px;
background-color: #FFF;
margin-top: 0px;
margin-bottom: 21.25px;
margin-left: 22px;
}
以及使用 CSS 的 HTML:
<body>
<div class="container">
<div class="header"><img src="Images/Top.png" width="964" height="117" alt="Intelligentlemen Films" /></div>
<div class="navbar"><img src="Images/RibbonMenu.png" width="964" height="69" alt="Navbar" /></div>
<div class="pagebody">
<div class="leftcol">
<div class="video"><iframe width="534" height="301" src="http://www.youtube.com/embed/kMBEuol6aUc" frameborder="0" allowfullscreen></iframe></div>
</div>
<div class="rightcol"><img src="Images/intelligentlemen button.jpg" width="300" height="61" alt="Intelligentlemen" /></div>
</div>
</div>
</body>
</html>