@media的示例

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<!--<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">-->

<title></title>
<!-- [if lt IE 9]>
  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
[endif] -->
<style>
@media screen and (min-width: 1200px){
body{
background-color: red;
}
}

@media screen and (min-width: 800px) and (max-width: 1200px){
body{
background-color: green;
}
}

@media screen and (max-width: 800px) {
body{
background-color: yellow;
}
}
</style>
</head>
<body>

</body>
</html>

猜你喜欢

转载自www.cnblogs.com/lxx7/p/9761640.html