基本上我试图将一个图标放在内部div的中心。在我的代码中,div里面有一个div。我想在最里面的div中居中文,所以我尝试使用margin-top:50%相反,文本走得更远。我认为最内层的div会在父分区和相应的位置找到中间点。请解释我为什么错了。 thx保证金顶部百分比与父div不匹配
<html>
<body>
<div id="container" style="height:1000px;width:100%;background-color: green;position:absolute;">
<div id="inner" style="height:50%; width:50%; background-color: black;margin-top:50%;display:inline-block;">
<div id="inner" style="height:50%; width:50%; background-color: yellow"></div>
</div>
</div>
</body>
我试图使HTML 100%高,但仍申报单没有很好地排队。这里是js小提琴:https://jsfiddle.net/op8sdq0a/ – st4rgut
感谢球员,我正在使用上面的例子作为这个网站的简化我正在尝试做,我想让箭头在照片中间画廊(绿色div)在任何一方。对不起,如果前面的例子提出了一个不同于这个小提琴的问题:https://jsfiddle.net/fqLmcnL3/1/ – st4rgut