天天看點

媒體查詢自定義栅格系統

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--設定縮放和繪制-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>媒體查詢自定義栅格系統</title>
<script src="../ mypethome/lib/html5shiv/html5shiv.js" ></script>
<script src="../ mypethome/lib/respond/respond.min.js" ></script>
<style>
/*
* 設定通用樣式
*/
*{
margin: 0;
padding: 0;
list-style: none;
}
.container{
height: 40px;
margin: 0 auto;
background-color: gold;
}
/*
* 媒體查詢
*/
@media screen and (max-width: 768px) {
/*超小螢幕*/
.container{
width: 100%;
}
}
@media screen and (min-width: 768px) and (max-width: 992px){
/*小螢幕*/
.container{
width: 750px;
}
}
@media screen and (min-width: 992px) and (max-width: 1200px){
/*大螢幕*/
.container{
width: 970px;
}
}
@media screen and (min-width: 1200px) {
/*超大螢幕*/
.container{
width: 1170px;
}
}
</style>
</head>
<body>
<div class="container">

</div>

</body>
</html>      

繼續閱讀