中心位置:固定元素
我想position: fixed;
以一个动态宽度和高度制作一个以屏幕为中心的弹出框。我用过margin: 5% auto;
这个。没有position: fixed;
它水平中心,但不垂直。添加后position: fixed;
,它甚至不会水平居中。
这是完整的集合:
.jqbox_innerhtml { position: fixed; width: 500px; height: 200px; margin: 5% auto; padding: 10px; border: 5px solid #ccc; background-color: #fff;}
<div class="jqbox_innerhtml"> This should be inside a horizontally and vertically centered box.</div>
如何使用CSS将此框置于屏幕中心?
12345678_0001