Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
幅が常に 50px のボタンがあります。親divの中央に水平に保つにはどうすればよいですか?
親 div の位置合わせを行いcenterます。
center
HTML:
<div class="parent"> <input type="button" class="button" value="Btn"/> </div>
CSS:
.parent{text-align:center;} .button{width:100px;}
ここでフィドル。
追加
display: block; margin: 0 auto;
それはそれを行う必要があります。. .