美文网首页
小程序样式-常用css布局对比Android

小程序样式-常用css布局对比Android

作者: zhongcx | 来源:发表于2018-08-19 19:44 被阅读0次

状态栏-自定义

xxx.json 状态栏颜色 仅支持 black/white

{
  "usingComponents": {},
  "navigationBarTextStyle": "white",
  "navigationStyle": "custom"
}

文字与图片常用属性

一般直接从蓝湖等设计图直接copy代码再改改。

.tv_content {
  /*TextView for text*/
  width: 100%; /*layout_width 宽度*/
  height: 100%; /*layout_height 高度*/
  font-size: 28rpx; /*textSize 文字大小*/
  color: #e64340; /*textColor 文字颜色*/
  background: linear-gradient(to right, #ff1919, #ff6533); /*background 背景 */
  border-radius: 3px; /*shape 圆角*/
  padding: 0rpx; /*padding 内边距 */
  margin: 0rpx; /*layout_margin 外边距*/
  font-weight: bold; /*取值(100-900):mormal:正常大小相当于400。bold :粗体,相当于700。bolder, lighter。*/
  border-style: solid; /*设置边框类型*/
  border-width: 1px; /*设置边框粗细*/
  border-color: #ff1919; /*设置边框颜色。*/
  display: flex;
  align-items: center; /**水平居中*/
  justify-content: center; /**垂直居中*/

  overflow: hidden; /*文本单行*/
  white-space: nowrap;
  text-overflow: ellipsis; 

  overflow:hidden;/*两行省略号*/
  text-overflow: ellipsis;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow:hidden;  /* swiper 让照片循环的时候不变成直角 */
  transform: translateY(0);  /*适配ios*/
}
.iv_content {
  /*ImageView for image mode="widthFix" 属性参考:https://developers.weixin.qq.com/miniprogram/dev/component/image.html*/
  width: 100%; /*layout_width 宽度*/
  height: 100%; /*layout_height 高度*/
  margin: 0rpx; /*layout_margin 外边距*/
  border-radius: 25rpx; /*圆形头像*/
}

线性与相对布局

线性布局

.ll_content {
  /**LinearLayout,父元素*/
  display: flex;/*scroll-view 横向滑动,需要设置成display: inline-block; 父布局要加white-space: nowrap;*/
  flex-direction: column; /*元素排列方向【row:横向排列】【column:纵向排列】*/
  justify-content: start; /*水平对齐方式【start:从左到右】【space-between:两端对齐】【center:居中】*/
  align-items: flex-start; /*垂直对方方式【flex-start:从上到下】【center:居中】*/
  flex-wrap:wrap; /*for循环外层需要这个属性,实现一行多个元素时需要配合display: flex; */
}
.v_content_child {
  /*子元素,占满剩余屏幕方法*/
  flex: 1; /*剩余充满,类似Android weight属性*/
  height: 0rpx; /*表示高度充满剩余屏幕,常用于1:1这种*/
}

相对布局

.rl_content {
  /**RelativeLayout,父元素*/
  position: relative; /**相对定位,子元素的absolute才能生效*/
}

.v_content_child {
  /**子元素*/
  position: absolute;
  bottom: 0rpx:/*如果设置了这个属性,则元素居底部对齐*/
}

适配

/*小程序 1像素 线的适配。方案*/
.line{
    height: 1rpx;
    border-bottom: solid 1rpx #E3E3E3; 
}

====================参考资料===================
1 图片处理
1.1 微信控件官方文档
https://developers.weixin.qq.com/miniprogram/dev/component/image.html
1.2 高斯模糊处理
https://www.jianshu.com/p/bb99dc1dfffb
1.3 微信小程序--旋转木马/缩放轮播图效果
https://www.jianshu.com/p/b65feaec5bad?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

2 布局处理
2.1 微信小程序之让view水平垂直居中
https://www.jianshu.com/p/869425b79546
2.2 弹性布局(display:flex;)属性详解
https://www.cnblogs.com/hellocd/p/10443237.html
2.3 微信小程序scroll-view占满剩余屏幕
https://www.jianshu.com/p/05f275d16121

3 状态栏获取
3.1 微信小程序自定义状态栏的高度设置
https://www.jianshu.com/p/c616ca9acf26
3.2 微信小程序顶部导航栏自定义
https://blog.csdn.net/qq_42445490/article/details/88827164

相关文章

  • 小程序样式-常用css布局对比Android

    状态栏-自定义 xxx.json 状态栏颜色 仅支持 black/white 文字与图片常用属性 一般直接从蓝湖等...

  • 小程序入门到精通(三):学小程序必备技术基础-flex布局

    学小程序我们需要有点html、css、js基础,而flex布局是我们小程序常用的css布局,学习小程序之前,我们需...

  • 实践小结

    GUI: 主程序 APP java 布局文件 Fxml .xml .html 布局 样式文件 css ...

  • APP

    主程序 .APP布局文件 .fxml .html样式文件 .css控制器 .java 布局文件 水平布局 垂直布局...

  • 006_布局任务与答案第一期(四川师范大学JavaWeb)

    试验目的 了解页面常用布局结构; 掌握 DIV+CSS 布局的基本方法; 3) 掌握用 CSS 改变页面样式的方法...

  • css

    css基础css选择器css常见样式1css常见样式2CSS布局上CSS布局下flex布局塔防小游戏flex布局青...

  • CSS入坑记录

    CSS入坑记录 插入方式 选择器 常用样式 盒子模型 布局 单位 CSS3 一.插入方式 1.内联样式表(行内样式...

  • 我的前端技能树

    HTML 常见标签和属性 HTML5 CSS 常用选择器 常用样式和布局 响应式布局(了解,并不熟悉) rem 的...

  • css布局和居中

    本文主要介绍了css常用的布局,居中等其他小技巧。 css布局 左右布局 利用float实现左右布局 左右模块设置...

  • 点时创新Web前端课程大纲

    一、html常用标签、列表、表格、表单... 二、css 样式字体设置、盒模型、网页布局... 三、JavaScr...

网友评论

      本文标题:小程序样式-常用css布局对比Android

      本文链接:https://www.haomeiwen.com/subject/vkgciftx.html