HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width initial-scale=1" >
视口 宽度自适应 缩放比例
<title>Title</title>
<link rel="stylesheet" href="bootstrap.css">
<style>
div{
border: 1px solid black;
height: 450px;
}
</style>
</head>
<body>
<!--主体部分-->
<div class="container"></div>
</body>
</html>
CSS
/*针对PC屏幕央视*/
@media screen and (min- 992px){
.container{
970px;
margin: 0 auto;
}
}
/*针对PAD屏幕的样式*/
@media screen and(min-768px ) and (max- 991px){
.container{
750px;
margin: 0 auto;
}
}
/*针对手机的样式*/
@media screen and (max- 767px){
.container{
100%;
margin: 0 auto;
}
}