转自:https://blog.csdn.net/u010372981/article/details/47406023
仅做个人笔记
css实例:
body {
background-color: white;
}
@media screen and (max-width: 960px){
body {
background-color: red;
}
}
@media screen and (max-width: 768px){
body {
background-color: yellow;
}
}
@media screen and (max-width: 550px){
body {
background-color: green;
}
}
@media screen and (max-width: 320px){
body {
background-color: blue;
}
}
https://blog.csdn.net/namechenfl/article/details/84766468
仅做个人笔记
html实例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
/*超大PC屏幕下的专用样式*/
@media screen and (min-width:1200px) {
div{
width: 500px;
height: 500px;
background: red;
}
}
/*中等PC屏幕下的专用样式*/
@media screen and (min-width:992px) and (max-width: 1199px) {
div{
width: 400px;
height: 400px;
background: red;
}
}
/*PAD屏幕下的专用样式*/
@media screen and (min-width: 768px) and (max-width:991px ){
div{
width: 300px;
height: 300px;
background: red;
}
}
/*PHONE屏幕下的专用样式*/
@media screen and (max-width:767px) {
div{
width: 100px;
height: 100px;
background: red;
}
}
</style>
</head>
<body>
<div>12</div>
</body>
</html>