我正在嘗試學習響應式設計。我正在建立一個網站,其中一個網頁是一個投資組合。我建立了以下如何佈置此頁面的模型。這當然是一個非常簡潔的版本。我似乎無法應用正確的查詢,因此這種格式在寬屏桌面,ipad上可以顯示,並且可以說一部手機。我開始了第一個查詢,但它當然不工作,也知道這是否是常見寬屏桌面的最佳尺寸。卡住此佈局上媒體查詢的最佳方法
任何人都可以讓我開始如何應用這個頁面?我將繼續教程,但需要在這裏啓動一個開始。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<style type="text/css">
@media screen and (max-width:1080px) {
#main {
width: 960px;
}
}
body {
background-color: #FFF;
margin:0;
}
#main {
width: 1080px;
margin-right: auto;
margin-left: auto;
height: 860px;
margin-top: 20px;
margin-bottom: 20px;
}
.box {
background-color: #CCC;
height: 200px;
width: 200px;
margin-right: 20px;
float: left;
margin-bottom: 20px;
}
.box_last {
background-color: #CCC;
height: 200px;
width: 200px;
float: left;
margin-bottom:20px;
}
.box_bottom {
background-color: #CCC;
height: 200px;
width: 200px;
margin-right: 20px;
float: left;
}
.box_last_bottom {
background-color: #CCC;
height: 200px;
width: 200px;
float: left;
}
</style>
</head>
<body>
<div id="main">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box_last"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box_last"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box_last"></div>
<div class="box_bottom"></div>
<div class="box_bottom"></div>
<div class="box_bottom"></div>
<div class="box_bottom"></div>
<div class="box_last_bottom"></div>
</div>
</body>
</html>
我覺得共同在外面使用負利潤最DIV,使內div可以有正邊距(讓它們之間有間距),但是沒有空間用於第一個/最後一個元素。如果你願意,我可以更好地解釋。 – Kubee