我試圖垂直對齊我的頁面,但我不能讓它工作。 我試過其他問題的其他解決方案,但目前爲止他們都沒有爲我工作,有誰知道爲什麼?垂直對齊無法正常工作CSS/HTML
這是HTML代碼中,我要垂直對齊:
header {
margin: 0 auto;
width: 600px;
margin-bottom: 3em;
margin-top: 3em;
text-align: center;
}
section {
width: 600px;
margin: 0 auto;
padding: 3px;
background-color: white;
}
#textbox {
color: #075488;
border: solid 3px #075488;
}
#textbox div {
font-weight: bold;
border-bottom: 2px solid #075488;
margin-left: 3em;
margin-right: 3em;
padding-left: 2em;
padding-right: 2em;
padding-top: 1.5em;
padding-bottom: 1em;
margin-bottom: 1em;
text-align: center;
}
#textbox table {
font-weight: normal;
width: 100%;
padding-right: 5em;
padding-left: 4em;
padding-bottom: 1em;
margin: 0 auto;
line-height: 1;
}
td:nth-child(3) {
width: 100px;
}
td:nth-child(2) {
text-align: center;
}
section p {
color: white;
font-size: 12px;
float: right;
}
<header id="header">
<img src="images/image.png">
</header>
<section id="section">
<div id="textbox">
<div>test</div>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
</div>
</section>
有誰知道一個解決方案?
謝謝你!
如果CSS是不可能的,可以使用jQuery/Javascript來代替,如果是這樣的話,我該怎麼做呢?
定義 「垂直對齊」。你想在什麼方面保持一致? – Quentin 2014-11-06 10:32:26
我希望垂直標題/部分居中,所以頁眉的頁邊空白部分與頁面空白部分的頁邊空白部分相同 – Stefan 2014-11-06 10:33:23
您是否問如何在窗口中間進行*整頁渲染? – Quentin 2014-11-06 10:35:26