1.盒型

  • width
  • height
  • padding
    • padding-left
    • padding-right
    • padding-top
    • padding-bottom
  • margin
    • margin-left
    • margin-right
    • margin-top
    • margin-bottom
  • border
    • border-style
    • border-width
      • border-left-width
      • border-top-width
      • border-right-width
      • border-bottom-width
    • border-color
      • border-left-color
      • border-top-color
      • border-right-color
      • border-bottom-color
    • border-radius
      • border-bottom-left-radius
      • border-bottom-right-radius
      • border-top-left-radius
      • border-top-right-radius
  <template>
<div style="width: 300; height: 100;">
<image src="http://img1.imgtn.bdimg.com/it/u=3942470672,3111472143&fm=21&gp=0.jpg" style="flex: 1;"></image>
</div>
</template>

2.弹性盒型

基于CSS flexbox Weex框风格模型,确保元素的行为可以预见和页面布局可以适应不同屏幕大小和不同的显示设备。Flexbox包含flex容器和flex节点。如果weex元素可以包含其他元素,这是一个flex容器。

旧版本和新的flexbox规范有差异,比如是否支持包装,旧版本是低于4.4版本的android版本。

2.1弹性容器

  • flex-directionrow | column

容器内布局垂直方向,默认值是自上而下 (top-to-bottom).

  • justify-contentflex-start | flex-end | center | space-between

容器内布局横向方向对其方向

  • align-itemsstretch | flex-start | center | flex-end

  <template>
<div style="width: 300; height: 100;">
<image src="http://img1.imgtn.bdimg.com/it/u=3942470672,3111472143&fm=21&gp=0.jpg" style="flex: 1;"></image>
<image src="http://pic2.ooopic.com/12/90/09/28bOOOPICd4_1024.jpg" style="flex: 1;"></image>
<image src="http://pic.58pic.com/58pic/13/06/19/81q58PICFkr_1024.jpg" style="flex: 1;"></image>
</div>
</template>
  <template>
<div style="width: 100;">
<image src="http://pic.58pic.com/58pic/13/06/19/81q58PICFkr_1024.jpg" style="width: 100; height: 100;"></image>
<div style="flex-direction: row;">
<text style="flex: 2; font-size: 32;">title</text>
<text style="flex: 1; font-size: 16;">$100</text>
</div>
</div>
</template>
<template>
<div style="flex-direction: row; justify-content: space-between;">
<text>WEEX</text>
<text>2016-05-08</text>
</div>
</template>

3.位置

  • positionrelative | absolute | fixed | sticky, default value is relative.

固定属性(fixed)保持位置固定当页面滚动的元素。粘性属性(sticky)保持元素定位为“卡”顶部或“相对”在原来的地方取决于它对滚动视图。

  • top: <number>, 向上偏移量,默认值为 0
  • bottom: <number>, 向下偏移量, 默认值为 0
  • left: <number>, 向左偏移量,默认值为 0
  • right: <number>, 向右偏移量,默认值为 0
<template>
<div style="flex-direction: column;">
<div style="height: 3000;">
<image src="http://pic.58pic.com/58pic/13/06/19/81q58PICFkr_1024.jpg" style="top: 50; left: 50;width: 100; height: 100;"></image>
</div>
<div style="height: 3000;">
<image src="http://pic.58pic.com/58pic/13/06/19/81q58PICFkr_1024.jpg" style="position: sticky;width: 100; height: 100;"></image>
</div>
<div style="height: 3000;">
<image src="http://pic.58pic.com/58pic/13/06/19/81q58PICFkr_1024.jpg" style="position: absolute; top: 800; left: 50;width: 100; height: 100;"></image>
</div>
<div style="height: 3000;">
<image src="http://pic.58pic.com/58pic/13/06/19/81q58PICFkr_1024.jpg" style="position: fixed; top: 50; left: 500;width: 100; height: 100;"></image>
</div>
</div>
</template>

4.文本样式

  • color: <colors> 前景色.
  • font-size: <length> 字体大小.
  • font-style: <enum> normal | italic. 字体类型(正常、斜体). 默认值是正常字体.
  • font-weight: <enum> normal | bold. 字体类型(正常、加粗).默认值是正常字体
  • text-decoration: <enum> none | underline | line-through. 字体是否带下划线. 默认不带.
  • text-align: <enum> left | center | right. 对齐在父容器的位置. 默认左对齐.
  • font-family:<string> 字体类型(宋体、微软雅黑。。。),如果没有找到设定的字体,会回退到默认字体,不同的系统可能会不一样
  • text-overflow:<string> clip | ellipsis. 当内容溢出的时候是否以省略符号结束.
.my-class { color: red; }
.my-class { color: #f00; }
.my-class { color: #ff0000; }
.my-class { color: rgb(255, 0, 0); }
.my-class { color: rgba(255, 0, 0, 0.5); }

Weex 样式的更多相关文章

  1. weex 通用样式以及需要注意的问题

    一.说明 weex 对于 css 样式的支持是非常有限的,并且使用样式的时候,必须遵循 weex 定义的规则. 对于不遵循 weex 样式规则的代码,往往在 web 页面上有效,而在 native 环 ...

  2. (26)打鸡儿教你Vue.js

    weex框架的使用 1.weex开发入门 2.weex开发环境搭建 3.掌握部分weex组件模块 4.了解一些vue基本常见语法 5.制作一个接近原生应用体验的app weex介绍 安装开发环境 We ...

  3. weex 数据绑定,动态控制组件的显示内容及样式

    无论的原生开发还是weex开发,经常会需要我们对一些组件/控件动态赋值,在原生中,我们大家都知道,对控件setText就可以了,那么在weex中呢,我们需要怎么做呢,其实很简单,几行代码就可以搞定!首 ...

  4. 第八章 交互技术,8.4 Weex 双11会场大规模应用的秒开实战和稳定性保障(作者:鬼道)

    8.4 Weex 双11会场大规模应用的秒开实战和稳定性保障 前言 Native 开发的诸多亮点中,流畅体验和系统调用是最多被提及的.流畅体验体现在页面滚动/动画的流畅性,背后是更好的内存管理和更接近 ...

  5. weex image

    weex 的image用来渲染图片, 可以使用img作为它的别名. 需要注意的是,他的长度可宽度必须指定, 不然它是不会工作的. 它没有任何的子组件. 有两个属性: src 用来指定图片的地址图片. ...

  6. weex scroller

    今天学习了一下weex的 scroller.就简单地对其整理一下自己的学习笔记. <scroller>这个标签只能出现在列(column)上面, 只有当它自己的内容大于类似与PC父级的高度 ...

  7. Weex中文文档

    这里整理当前已译出的Weex中文文档,如需查阅完整Weex文档,请访问http://alibaba.github.io/weex/doc/ . 同时也欢迎大家参与Weex中文文档翻译 [Guide] ...

  8. Weex详解:灵活的移动端高性能动态化方案

    原文地址:http://www.infoq.com/cn/articles/introducing-weex 在2016年4月份的QCon上,阿里巴巴资深总监,淘宝移动平台及新业务事业部.阿里百川负责 ...

  9. Weex 初始

    1.一旦数据和模板绑定,数据的变化会立即体现在前台的变化 <template> <container> <text style="font-size: {{si ...

随机推荐

  1. sqlserver 学习

    http://www.cnblogs.com/CareySon/category/411344.html SQL Server查找的最小单位实际上是页.也就是说即使你只查找一行很小的数据,SQL Se ...

  2. 深入了解一下PYTHON中关于SOCKETSERVER的模块-D

    在LINUX上以FORK的方式使用SIMPLEHTTPSERVER. 记得哟,THREADING能在WIN和LINUX上实现,但FORK,不支持WIN的. 除了SIMPLE之外,还有CGI,就不示例啦 ...

  3. Spring MVC 解读——View,ViewResolver(转)

    上一篇文章(1)(2)分析了Spring是如何调用和执行控制器方法,以及处理返回结果的,现在我们就分析下Spring如何解析返回的结果生成响应的视图. 一.概念理解 View ---View接口表示一 ...

  4. Android中SharedPreferences和序列化结合保存对象数据

    前言: 最近在做用户注册的时候,遇到了需要填写很多表单数据,不可能在一页把所有的数据都展示完全,因此采用了分页的方式,由于在用户填写数据数据之后我们需要对用户填写的数据进行暂时的记录的,当用户会到此页 ...

  5. Oracle 字符集的查看和修改 -转

    一.什么是Oracle字符集 Oracle字符集是一个字节数据的解释的符号集合,有大小之分,有相互的包容关系.ORACLE 支持国家语言的体系结构允许你使用本地化语言来存储,处理,检索数据.它使数据库 ...

  6. zoj 3088 Easter Holidays(最长路+最短路+打印路径)

    Scandinavians often make vacation during the Easter holidays in the largest ski resort Are. Are prov ...

  7. del重复数

    楼主 发表于: 2010-06-21 11:46:31 本帖最后由 luckycynthia 于 2010-06-21 11:47:46 编辑 在抓取数据后对数据进行操作的途中,有时候会碰到重复数据, ...

  8. 锐浪应用小插曲,asp.net下的使用

    下午提前完成了今天的工作内容,整了下bs中的应用,嘿嘿,其中遇到不少问题,接下来说下大概会遇到哪些问题,1:grid++ 6.0插件下载安装之后ie浏览器无法打开,居然什么都没有显示,奇葩啊,系统版本 ...

  9. HDOJ 2030 汉字统计

    Problem Description 统计给定文本文件中汉字的个数. Input 输入文件首先包含一个整数n,表示测试实例的个数,然后是n段文本. Output 对于每一段文本,输出其中的汉字的个数 ...

  10. [转载]css hack

    做前端多年,虽然不是经常需要hack,但是我们经常会遇到各浏览器表现不一致的情况.基于此,某些情况我们会极不情愿的使用这个不太友好的方式来达到大家要求的页面表现.我个人是不太推荐使用hack的,要知道 ...