現在、cssでectファイルの中のものを中央寄せにしようとしています。
ectファイルの中身は以下の通りで、
alertbackはアラートが出た際にalertboxの周りを黒くするものです。
text-align:centerやmargin: 0 auto;などで中央に寄せようとしましたが、どうもうまくいきません。
div id="alertbox"自体を中央に寄せようと思っています。
どなたかご助言お願いいたします。
lang
1 <!-- アラートの背景の全画面黒 --> 2 <div id="alertback"></div> 3 4 <!-- アラートボックス --> 5 <div id="alertbox"> 6 <div id="alertmessage"> 7 </div> 8 <div id="alertbtn"> 9 <p>OK</p> 10 </div> 11 </div>
lang
1#alertback{ 2 width: 100%; 3 height: 100%; 4 background-color: black; 5 opacity: 0.7; 6 position: fixed; 7 top: 0; 8 z-index: 1000000; 9} 10#alertbox{ 11 width: 300px; 12 height: 200px; 13 border-radius: 8px; 14 border:1px solid gray; 15 background-color: white; 16 position: fixed; 17 top: 30%; 18 z-index: 10000000; 19} 20#alertmessage{ 21 height: 75%; 22 width: 100%; 23 border-bottom: 1px solid gray; 24} 25#alertbtn{ 26 height: 25%; 27 width: 100%; 28} 29#alertbtn p{ 30 text-align: center; 31 margin-top: 13px; 32}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/07/10 07:34