博客
关于我
记移动端一些页面布局样式
阅读量:392 次
发布时间:2019-03-05

本文共 1417 字,大约阅读时间需要 4 分钟。

移动端页面布局样式参考

在移动端页面设计时,布局样式需要根据不同屏幕尺寸进行优化,常用的方法包括使用rem单位作为高度,宽度使用百分比,并结合Flexbox布局。以下是一些常见的布局技巧参考:

1. 搜索栏布局

搜索栏通常采用固定定位,宽度为100%,高度可以根据需求设置。例如:

.search-bar {  position: fixed;  width: 100%;  height: 50px;  display: flex;}

1.1 左边、1.2 中间、1.3 右边布局

这种布局适用于侧边菜单或内容展示。可以通过Flexbox实现:

.side-menu {  display: flex;  width: 100%;  height: 100vh;}.menu-item {  width: 25%;  height: 100%;  display: flex;  flex-direction: column;  align-items: center;}

2. Tab菜单布局

Tab菜单通常采用表格布局(table),内部可以包含多个Tab内容。例如:

.tab-container {  width: 100%;  height: 200px;  overflow: hidden;}.tab-content {  display: table-cell;  width: 20%;  padding: 20px;}

2.4 图标布局

图标布局可以通过固定宽高和背景图片实现居中效果。例如:

.icon-item {  width: 80px;  height: 80px;  background: url('icon.png');  display: flex;  justify-content: center;  align-items: center;}

3. 横向滚动菜单布局

横向滚动菜单通常采用多层盒子结构,内部使用overflow隐藏。例如:

.menu-wrapper {  width: 100%;  height: 120px;  overflow: hidden;}.menu-item {  display: flex;  width: 200px;  height: 40px;  align-items: center;  justify-content: center;}

4. 左右各占50%的纵向排列

这种布局适用于内容分区,通常使用Flexbox实现。例如:

.content-container {  display: flex;  width: 100%;  height: 100vh;}.left-content {  width: 50%;}.right-content {  width: 50%;}

4.5 图片布局

图片布局需要根据具体需求设置宽高和定位。例如:

.image-container {  width: 100%;  height: 300px;  background: #f0f0f0;  overflow: hidden;}.image-item {  width: 100%;  height: 100%;  object-fit: cover;}

这些布局样式可以根据具体需求进行调整,确保在不同屏幕尺寸下仍然保持良好的显示效果。

转载地址:http://vcgwz.baihongyu.com/

你可能感兴趣的文章
Objective-C实现DBSCAN聚类算法(附完整源码)
查看>>
Objective-C实现decision tree决策树算法(附完整源码)
查看>>
Objective-C实现degreeToRadian度到弧度算法(附完整源码)
查看>>
Objective-C实现depth first search深度优先搜索算法(附完整源码)
查看>>
Objective-C实现des文件加密算法(附完整源码)
查看>>
Objective-C实现detectDirectedCycle检测定向循环算法(附完整源码)
查看>>
Objective-C实现deutsch jozsa算法(附完整源码)
查看>>
Objective-C实现DFS判断是否是二分图Bipartite算法(附完整源码)
查看>>
Objective-C实现DFS遍历或搜索图数据结构算法(附完整源码)
查看>>
Objective-C实现Diffie-Hellman算法(附完整源码)
查看>>
Objective-C实现Diffie—Hellman密钥交换(附完整源码)
查看>>
Objective-C实现Diffie—Hellman密钥交换(附完整源码)
查看>>
Objective-C实现Dijkstra最小路径算法(附完整源码)
查看>>
Objective-C实现dijkstra迪杰斯特拉算法(附完整源码)
查看>>
Objective-C实现dijkstra迪杰斯特拉算法(附完整源码)
查看>>
Objective-C实现Dijkstra迪杰斯特拉算法(附完整源码)
查看>>
Objective-C实现dijkstra银行家算法(附完整源码)
查看>>
Objective-C实现Dinic算法(附完整源码)
查看>>
Objective-C实现disjoint set不相交集算法(附完整源码)
查看>>
Objective-C实现DisjointSet并查集的算法(附完整源码)
查看>>