当前位置:网站首页>移动Web实训DAY-1
移动Web实训DAY-1
2022-06-28 12:55:00 【HHppGo】
1. 移动端特点
1.1 移动端和PC端网页不同点
- 尺寸不同:
- PC屏幕大,移动端屏幕小
- 内容位置不同:
- PC端内容在版心
- 移动端内容铺满屏幕的,占屏幕宽度的100%
- 总结:
- 通过比较不同点,我们就认识到了,不同的移动端,屏幕宽度不同
- 将来需要做移动端Web页面的适配(核心)

1.2 谷歌模拟器
- 作用:可以很方便的模拟出不同移动端设备,进行代码和效果调试
1.3 分辨率
即像素格数
为什么要了解设备分辨率?
- 不同的设备分辨率不相同的,为了知道将来开发参照什么分辨率写代码,需要了解分辨率
屏幕尺寸:
- 屏幕对角线的距离,单位英寸
屏幕分辨率:
- 物理分辨率
- 设备出厂的分辨率,属于硬件层面,不能改
- 逻辑分辨率
- 通过系统的驱动去缩放之后的分辨率,可以修改
- 开发时,参照那种分辨率?
- 逻辑分辨率
- 物理分辨率
1.4 视口
概念:
- 网页的可视区域

- 网页的可视区域
开发中,网页的宽度需要跟设备的逻辑像素宽度一致,如何实现?
<head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 视口标签:保证网页宽度和设备的逻辑像素一样的 --> <!-- name="viewport" 表示 视口,页面的可视区域 --> <!-- content="width=device-width 表示 页面的可视区域的宽度是设备宽度(逻辑像素宽度) --> <!-- initial-scale=1.0" 表示分辨率的缩放比,1.0 == 100%,不缩放 --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>测试视口宽度</title> </head>
1.5 二倍图
设计师为什么要设计二倍图?
- 保证图片放在不同的屏幕上时,不会模糊
前端开发者,写代码参照哪个分辨率?
- 逻辑分辨率(对应的就是一倍图)
2. 百分比布局(了解)
效果:
宽度自适应,高度固定
宽度使用百分比的方式自适应
.toolbar li { float: left; /* 百分比布局:宽度自适应 让五个li标签,每个li标签占据父级的五分之一 20% */ width: 20%; /* 百分比布局:高度固定 */ height: 50px; }
3. Flex布局
3.1 组成部分

- 作用:
- 基于 Flex 精确灵活控制块级盒子的布局方式,避免浮动布局中脱离文档流现象发生。
- Flex布局非常适合结构化布局
- 设置方式:
- 父元素添加 display: flex;
- 组成部分:
- 弹性容器
- 弹性盒子
- 主轴
- 侧轴
3.2 主轴对齐方式
/* flex布局 */
display: flex;
/* 调整水平方向的间距 */
/* 默认值,从左往右依次排列,没有间距 */
justify-content: flex-start;
/* 默认值,从右向左依次排列,没有间距 */
justify-content: flex-end;
/* 沿着主轴方向居中排列,没有间距 */
justify-content: center;
/* 沿着主轴方向,每个盒子都有相同的左右间距 */
justify-content: space-around;
/* 沿着主轴方向,最左和最右的盒子紧贴着父级的左右,间距平局分配给其他盒子 */
justify-content: space-between;
/* 沿着主轴方向,每个弹性盒子间距相同的 */
justify-content: space-evenly;
效果:
justify-content: center;沿着主轴方向居中排列,没有间距
justify-content: space-around;沿着主轴方向,每个盒子都有相同的左右间距
justify-content: space-between;沿着主轴方向,最左和最右的盒子紧贴着父级的左右,间距平局分配给其他盒子
justify-content: space-evenly;沿着主轴方向,每个弹性盒子间距相同的
边栏推荐
- VS2012 VC新建一个空白窗口应用
- mysql数据库扫盲,你真的知道什么是数据库嘛
- unity发布 webgl在手机端 inputfield唤醒键盘输入
- 自定义MySQL连接池
- JS class is not just a simple syntax sugar!
- 华泰证券手机app下载 怎么办理开户最安全
- Copy 10 for one article! The top conference papers published in South Korea were exposed to be plagiarized, and the first author was "original sin"?
- ASP.NET CORE Study01
- I²C、SMBus、PMBus关系
- Mysq 8.0 launched histogram, which greatly improved the performance!
猜你喜欢

嵌入式开发:估算电池寿命的7个技巧

Copying open source for basic software is not advisable. Self reliance is the right way
![[today in history] June 28: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born](/img/bf/09ccf36caec099098a22f0e8b670bd.png)
[today in history] June 28: musk was born; Microsoft launches office 365; The inventor of Chua's circuit was born

go template with...end遍历用法

ASP. NET CORE Study04

【云原生】自助报表和BI能做这么多事?

从 jsonpath 和 xpath 到 SPL

1015.摘花生

Mysq 8.0 launched histogram, which greatly improved the performance!

一款自动生成单元测试的 IDEA 插件,开发效率提升 70% 以上!
随机推荐
Login interface accesses and clears the token
Digital twin energy system, creating a "perspective" in the low-carbon era
微服务稳定性保障
UDP传输rtp数据包丢帧
Flink流处理API大合集:掌握所有flink流处理技术,看这一篇就够了
【MySQL从入门到精通】【高级篇】(三)MySQL用户的创建_修改_删除以及密码的设置
如何在Microsoft Exchange 2010中安装SSL证书
Jerry's wif interferes with Bluetooth [chapter]
Manjaro easyconnecy error: libgtk-x11-2.0 so. 0: cannot open shared object file: No such file or directory
Summary of 2022 China Merchants fintech competition
How to handle the safest account opening when downloading the mobile app of Huatai Securities
go template with...end遍历用法
同花顺上怎么进行开户啊, 安全吗
Unity releases webgl and wakes up keyboard input on the mobile terminal inputfield
词云的可视化设计教程
【历史上的今天】6 月 28 日:马斯克诞生;微软推出 Office 365;蔡氏电路的发明者出生
认识启动函数,找到用户入口
Realization of a springboard machine
ASP.NET CORE Study01
自定义MySQL连接池



