作者KaiLoveMoon (炼月)
看板Ajax
标题[问题] 有关於 div 并排置中
时间Tue Dec 6 19:31:07 2011
我有五个DIV分别是
<body>
<div id="LogoArea" class="Logo"></div>
<div id="MenuBar" class="MenuBar"></div>
<div id="SubMenu" class="SubMenu"></div>
<div id="MainArea" class="MainArea"></div>
<div id="footer" class="Footer"></div>
</body>
CSS 部分
div.Logo {
margin: auto ;
text-align: center;
width: 1000px;
height: 50px;
background-color: #FF0000;
}
div.MenuBar {
margin: auto ;
text-align: center;
width: 1000px;
height: 30px;
z-index: 8;
text-align: center;
background-color: #00FF00;
}
div.SubMenu {
/*position: relative;
left: 0px;
top: 3px;*/
display:table-cell;
margin: auto ;
text-align: center;
width: 200px;
height: 540px;
text-align: center;
width: 1000px;
height: 50px;
background-color: #FF0000;
}
div.MenuBar {
margin: auto ;
text-align: center;
width: 1000px;
height: 30px;
z-index: 8;
text-align: center;
background-color: #00FF00;
}
div.SubMenu {
display:table-cell;
margin: auto ;
text-align: center;
width: 200px;
height: 540px;
z-index: 1;
background-color: #FF0000; /*#f0f0f0*/
}
div.MainArea {
display:table-cell;
margin: auto ;
text-align: center;
width: 800px;
height: 540px;
z-index: 1;
background-color: #00FF00;
}
div.Footer {
position: relative;
clear: right;
width: 1000px;
height: 30px;
background-color: #000000;
}
为了要让 SubMenu 和 MainArea 并列 所以使用display:table-cell;
却一直无法置中....
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.250.36.107
1F:→ gogomambo:多用一个DIV把SubMenu 和 MainArea包起来! 12/07 16:11