我想創建一個由9個圈子組成的響應式頁面。在下面的代碼中,每當更改瀏覽器大小(不響應)時,都會更改它們的位置。我嘗試使用CSS @media查詢,但無法創建響應式。在網頁中創建響應式圈子
我應該使用位置寬度的百分比,高度而不是固定的100px?
<html>
<head>
<style>
.circle1{
width:100px;
height:100px;
margin-left:600px;
background-color:black;
border-radius:100px;
}
.circle2{
margin-left:600px;
margin-top:30%;
width: 100px;
height:100px;
background-color:darkred;
border-radius:100px;
}
.circle3{
margin-left:250px;
margin-top:-27%;
width: 100px;
height:100px;
background-color:gold;
border-radius:100px;
}
.circle4{
margin-top:-20%;
margin-left:350px;
width:100px;
height:100px;
background-color:greenyellow;
border-radius:100px;
}
.circle5{
margin-left:63%;
margin-top:-8%;
width: 100px;
height:100px;
background-color:blueviolet;
border-radius:100px;
}
.circle6{
margin-left:900px;
margin-top:5%;
width: 100px;
height:100px;
background-color:deeppink;
border-radius:100px;
*emphasized text*
}
.circle7{
margin-left:350px;
margin-top:7%;
width: 100px;
height:100px;
background-color:blue;
border-radius:100px;
}
.circle8{
margin-left:800px;
margin-top:-10%;
width : 100px;
height:100px;
background-color:aqua;
border-radius:100px;
}
.circle9{
margin-left:600px;
margin-top:-20%;
width: 100px;
height:100px;
background-color:darkorange;
border-radius:100px;
}
</style>
</head>
<body>
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
<div class="circle5"></div>
<div class="circle6"></div>
<div class="circle7"></div>
<div class="circle8"></div>
<div class="circle9"></div>
</body>
</html>
該位置做你想做的9圈是我n桌面/平板電腦/手機? –
我通過mozilla瀏覽器開發人員模式在筆記本電腦上水平更改屏幕大小。預期的結果是一箇中心圈,其餘8個圈。 – vineeth
[以中心內容爲響應圈]的可能重複(http://stackoverflow.com/questions/34788537/responsive-circle-with-centered-content) –