• Weex 样式


    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=" 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

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

    justify-content

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

    align-items

      <template>
      <div style=" 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=" 100;">
        <image src="http://pic.58pic.com/58pic/13/06/19/81q58PICFkr_1024.jpg" style=" 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; 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; 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; 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; 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); }

     

  • 相关阅读:
    使用 Python 第三方库 daft 绘制 PGM 中的贝叶斯网络
    winedt (latex 编译器)解决中文的问题(CJK & CTEX)
    winedt (latex 编译器)解决中文的问题(CJK & CTEX)
    使用 LaTeX 绘制 PGM(Probabilistic Graphical Models)中的贝叶斯网络(bayesian networks)
    vc访问ACCESS数据库
    直接通过ADO操作Access数据库
    STL容器——对map排序
    C++ STL中Map的按Key排序和按Value排序
    C++直接初始化和复制初始化2
    C++直接初始化和复制初始化1
  • 原文地址:https://www.cnblogs.com/Jsonlu/p/5618305.html
Copyright © 2020-2023  润新知