私は3つのdiv(色のついた四角形)とボタンを持っています。3つのdivの下のボタンを中心に
divの下にボタンの中心を合わせるにはどうすればよいですか?
私の現在のコードでは、ボタンは#squares
と同じ行に表示され、左に浮いています。あなたの答えをありがとう。
#div1 {
background-color: red;
width: 100px;
height: 100px;
margin-right: 10px;
}
#div2 {
background-color: green;
width: 100px;
height: 100px;
margin-right: 10px;
}
#div3 {
background-color: blue;
width: 100px;
height: 100px;
}
#squares {
display: flex;
position: absolute;
margin-left: 35%;
}
#button {
width: 100px;
height: 50px;
clear: both;
}
<div id="squares">
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
</div>
<div id="button">
<button>Click me!</button>
</div>
感謝の男が、うまく動作します。 – bu246