我有一個div在float:left div內,它不想垂直對齊。我以爲我可以完全填充浮動div與內部股利,並設置一個顯示:表格單元格,但它似乎並不希望填充div和允許此顯示?垂直中心div包含浮動div
<div id="tabs-3" aria-labelledby="ui-id-3" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-expanded="true" aria-hidden="false" style="">
<div id="DivToCenter">
<div id="ButtonContainer">
<ul>
<li><div class="TemplateButton"><a href="http://www.google.com">Report an Issue</a></div></li>
<li><div class="TemplateButton"><a href="http://www.google.com">Report an Issue</a></div></li>
<li><div class="TemplateButton"><a href="http://www.google.com">Report an Issue</a></div></li>
<li><div class="TemplateButton"><a href="http://www.google.com">Report an Issue</a></div></li>
</ul>
</div>
</div>
</div>
造型:
#tabs-3 { /* Tab Content Panel (Right Panel)*/
float: left;
min-height: 300px; /* How tall is our tab box, minimum?*/
text-align: center;
background-color: pink;
}
#DivToCenter {
width: 100%;
height: 100%;
background: red;
display: table-cell;
vertical-align: middle;
text-align: center;
}
#ButtonContainer {
width: 100%;
overflow: auto;
padding-top: 10px;
padding-bottom: 10px;
background: green;
display: table-cell;
vertical-align: middle;
text-align: center;
}
#ButtonContainer > ul {
padding: 0;
margin: 0;
display: inline-block;
}
#ButtonContainer > ul > li {
display: inline-block; /*Puts the buttons in a line*/
}
.TemplateButton {
padding-left: 5px;
padding-right: 5px;
}
.ui-tabs-panel.ui-widget-content .TemplateButton > a {
/* SHAPE */
width: 119px;
height: 119px;
padding: 15px;
margin-left: 3px;
margin-right: 3px;
border: 1px solid white;
border-radius: 15px;
-moz-border-radius: 15px;
/* ALIGNMENT */
display: table-cell;
vertical-align: middle;
text-align: center;
/* STYLING */
font-weight: bold;
font-size: 1.25em;
color: white;
background-color: #0c428f;
}
.ui-tabs-panel.ui-widget-content .TemplateButton > a:hover {
background-color: #6795bb;
}
實際上可以我沒有得到你的問題? 'display:table:cell'似乎完美地工作。嘗試調整輸出窗口的大小,你可以看到我在說什麼? –