私はやや初心者のプログラマーなので、練習用の Web サイトを作成しています。このウェブサイトでは、ブロックが虹色の順序で垂直に下がっていることを示す必要があります。最初の列は問題なく取得できましたが、2 番目の列を実際に右に移動することはできません。私はrelativeとmargin-left: 110;を試しました。margin-top: 660; ですが、機能していません。各ボックスは 110 x 110 です。これが私のコードです。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "using namespace std;
<html>
<body>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<style>
div:first-child {
width: 110;
height: 110;
margin: 0px 0px 0px 0px;
background-color: red;
border-radius: 25px;
}
div:nth-child(2) {
width: 110;
height: 110;
margin: 0px 0px 0px 0px;
background-color: orange;
border-radius: 25px;
}
div:nth-child(3) {
width: 110;
height: 110;
margin: 0px 0px 0px 0px;
background-color: yellow;
border-radius: 25px;
}
div:nth-child(4) {
width: 110;
height: 110;
margin: 0px 0px 0px 0px;
background-color: green;
border-radius: 25px;
}
div:nth-child(5) {
width: 110;
height: 110;
margin: 0px 0px 0px 0px;
position: relative;
margin-left: 0;
background-color: blue;
border-radius: 25px;
}
div:nth-child(6) {
width: 110;
height: 110;
margin: 0px 0px 0px 0px;
position: relative;
margin-left: 0;
background-color: purple;
border-radius: 25px;
}
div:nth-child(1) {
width: 110;
height: 110;
position: relative;
margin-left: 110px;
margin-top: 660px;
margin: 0px 0px 0px 0px;
background-color: red;
border-radius: 25px;
}
</body>
</html>