Html IE:在中间垂直对齐表格
我的页面在水平和垂直方向居中,该页面在所有浏览器中都可用,但对于IE,该页面仅在Html IE:在中间垂直对齐表格,html,css,internet-explorer,Html,Css,Internet Explorer,我的页面在水平和垂直方向居中,该页面在所有浏览器中都可用,但对于IE,该页面仅在IE11(最新版本)中可用。在IE 10、9和8中,表格在页面顶部垂直对齐。如何使垂直对齐在IE 10、9和8中工作,我需要更改什么 Html jsiddle:旧版IE无法很好地处理html和正文的display:table。此外,它是不需要的 解决方案:不要将display:table分配给html,只分配给body。html只需要高度:100% html{ 身高:100%; } 身体 { 保证金:0; 宽度:10
IE11
(最新版本)中可用。在IE 10、9和8中,表格在页面顶部垂直对齐。如何使垂直对齐在IE 10、9和8中工作,我需要更改什么
Html
jsiddle:旧版IE无法很好地处理html和正文的
display:table
。此外,它是不需要的
解决方案:不要将display:table
分配给html
,只分配给body
。html
只需要高度:100%
html{
身高:100%;
}
身体
{
保证金:0;
宽度:100%;
身高:100%;
显示:表格;
}
表现在在每个浏览器的顶部对齐,我希望表格在中间垂直对齐。哦,很抱歉,我没有足够的咖啡。我让它工作,然后我删除了未使用的CSS发布之前。但它并不是真的没用过!因此,我编辑了答案并进行了更正。很抱歉。
<body>
<div class="container">
<div class="content">
<table width="350px">
<tr>
<td>
<img border='0' src='https://upload.wikimedia.org/wikipedia/commons/a/a5/Information_example_page2_300px.jpg' width='300' height='300' style="margin:25px 25px 50px 25px;">
</td>
</tr>
<tr>
<td align="center">
<p style="margin: 0px 0px 50px 0px;">Street<br>
0000AA City
</p>
</td>
</tr>
<tr>
<td align="center" class="contact">
<p style="margin: 0px 0px 50px 0px;">
<span style="color:#DDB4A4;">T</span> <a href="tel:000000">000000</a><br>
<span style="color:#DDB4A4;">E</span> <a href="mailto:info@info.com">info@info.nl</a><br>
</p>
</td>
</tr>
<tr>
<td align="center">
<p style="color:#999999; margin: 0px 0px 25px 0px; font-size: 16px;">Text</p>
</td>
</tr>
</table>
</div>
</div>
<body>
html, body
{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
display: table;
}
.container {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.content {
display: inline-block;
text-align: left;
}
table {
font-size:18px;
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
color: #4D4D4D;
}
.contact a:link
{
color: #4D4D4D;
text-decoration: none;
}
.contact a:hover
{
color: #1a0dab;
text-decoration: underline;
}