我有一個問題,當我放大和縮小頁面的佈局會搞砸。我在網上搜索其他帖子,但沒有真正幫助。也許是因爲我安排我的CSS的方式。希望有人能向我解釋如何解決這個問題,謝謝。這是它之前和之後的樣子。當我放大或縮小html佈局搞砸
前
後
HTML
<body>
<div id="container">
<div style="position:static">
<ul class="items">
<li>ABOUT KDU</li>
<li style="margin-left:30%;">ADMISSION</li>
<img src="kdulogo.png" class="MainImage"
style="position:static;">
<li style="margin-left:60%;">CAMPUS LIFE</li>
<li style="margin-left:75%;">INTERNATIONAL STUDENT</li>
</ul>
</div>
<div id="blocks">
<ul id=" Images">
<li><img src="SCCM.jpg" class="imageSize"></li>
<li><img src="SCCA.jpg" class="imageSize"></li>
<li><img src="SOB.jpg" class="imageSize"></li>
<li><img src="SHTCA.jpg" class="imageSize" style="margin-
left:210px;"></li>
<li><img src="SOE.jpg" class="imageSize"></li>
</ul>
</div>
</div>
</body>
CSS
*{
margin: 0;
padding: 0;
user-select: none;
font-family: "Futura PT Multilingual W02",Futura,Helvetica,Arial,sans-
serif;
font-weight: bold;
overflow-x: hidden;
}
body{
background: #f5f5f0;
}
.MainImage{
position: relative;
width: 10%;
margin: auto;
display: block;
transition: all .6s linear;
}
.items>li{
color: black;
cursor: pointer;
margin-left: 150px;
position: absolute;
top: 100px;
display: inline;
text-decoration: none;
transition: all .2s linear;
}
.items>li:hover{
text-decoration: underline;
text-decoration-color: black;
transition: all .2s linear;
transform: scale(1.5,1.5);
}
#blocks{
background-color: #262626;
width: 100%;
height: 517;
position: static;
margin-top: 50px;
}
#blocks >ul>li{
display:block;
float:left;
border: 20px;
margin-top: 30px;
margin-left: 80px;
}
#Images{
position: absolute;
display: inline;
}
#Image>li{
position: absolute;
display: block;
}
.imageSize{
cursor: pointer;
width: 340px;
height: 200px;
transition: all .4s linear;
}
.imageSize:hover{
opacity: 0.5;
transition: all .4s linear;
}
#container{
width: 100%;
margin: 0 auto;
在SO上不允許詢問教程或其他參考。另外,SO是針對具體問題提出具體問題的。你的問題對於這個平臺來說太廣泛了。 – Rob