スタイルシートで上下左右真ん中に配置
- topがauto以外
- marginがautoであること
要素 { position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; width: 300px; height: 300px; }
左右のみの場合は、topとleftにautoを指定
要素 { position: absolute; top: 0; left: 0; right: 0; bottom: 0; margin: auto; width: 300px; height: 300px; }
左右のみの場合は、topとleftにautoを指定