媒体查询(media query)
在写css代码中 要进行 媒体条件查询 如下图,在屏幕宽度最大为 320px(0px-320px)时,页面背景为红色,

结果示意图 如下

多个媒体查询可能会存在后面的样式覆盖前面的样式 可以用and
进行隔绝

结果示意图

也可以用link
引入css时 进行 媒体查询

但是在运行代码过程中,浏览器还会默认缩放行为,需要加上一段代码,阻止用户缩放
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
手机端的交互方式不一样,具体如下 :
- 没有 hover
- 有 touch 事件
- 没有 resize
- 没有滚动条
网友评论