【发布时间】:2017-01-27 00:41:31
【问题描述】:
我想知道,是否可以在不使用 % 的情况下使这个中心框位于页面的“最”中心?
我正在使用 VPS,并且我有一些 Python 正在运行,所以我不知道如何使用 % sizes 来使其正确。但这就是我想出多远才听说这不是以 1280x1024 为中心的:
https://s18.postimg.org/vta0qfd5l/2809583a0f43627d0fc1b428863b3faa.jpg
这是我使用的代码:
h2 {
margin: 0;
}
body {
background-color: #121212;
background-image: url("https://app.box.com/shared/static/vgfs65li424fk8h4n5e23pm7070yrewq.jpg");
background-size: contain;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-height: auto;
max width: 1200px;
}
table {
display: inline-block;
position: absolute;
max-width: 350px;
max-height: 265px;
border: 5px ridge yellow;
top: 0;
bottom: 0;
margin: auto;
left: 0;
right: 0;
padding-left: 90px;
padding-right: 90px;
background: rgba(255, 255, 255, 0.8);
}
div {
text-align: center;
align: center;
}
<div>
<table>
</table>
</div>
那么,知道我可以改进什么来“钉它”吗?我注意到,如果我向最大宽度添加更多,完整框会向左移动。也许如果我能解决这个问题,我也会解决第一个问题?
这个问题很独特,因为我不能使用百分比来正确对齐表格,所以我只想知道这是否可能。
谢谢!
【问题讨论】:
-
你说的是哪个盒子?
-
提供 fiddle 或 codepen 以便更好地理解。!
-
在 IE 版本中你必须走多远?
-
IE 根本不重要。 @Bálint 中心的盒子,里面有注册表
-
它在我看来相当集中,我错过了什么?