@media only screen and (max-width:640px)中的问题,响应式布局

时间:2023-03-09 02:14:20
@media only screen and (max-width:640px)中的问题,响应式布局
<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">
<link rel="stylesheet" type="text/css" href="./mediaTest.css" media="(max-width:640px)" >  注: 在link中加  media="(max-width:640px)"   是对整个mediaTest.css文件起作用
                                            用法。。。
<title>框架起手势</title>
</head>
下面是 “./mediaTest.css” 这个文件:
@media only screen and (max-width:639px) {
    body {  background-color: red }
    /* 清楚浮动 */
    .left, .right {clear: both;}
  }