16
位置を中央揃え:固定要素
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> コードスニペットを実行するHide resultsスニペットを展開 CSSでこのボックスを画面の中央に配置するにはどうすればよいですか?
438
css
css-position
centering