Centralize div with display inline-block and position relative
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: i'm trying to centralize in the vertically and horizontally, but without success: https://jsfiddle.net/szg7hhph/1/embedded/result/ HTML: <div id = "new__event" > <div class = "target" > <h2> Free Pass </h2> </div> </div> body { margin: 0; } #new__event { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; opacity: 0; transition: opacity 200ms; } #new__event { pointer-events: all; opacity: 1; } #new__event .target { cursor: pointer; position: relative; display: inline-block; padding: 48px; width: 50%; margin