美文网首页
materialize 布局1 --- 背景、文本设置

materialize 布局1 --- 背景、文本设置

作者: 晨曦Bai | 来源:发表于2019-07-08 14:38 被阅读0次

https://materializecss.com/
material design 配色:
https://material.io/archive/guidelines/style/color.html#color-color-system
materializecss 配色:
https://materializecss.com/color.html

设置背景颜色、文本颜色、文本宽度、文本对齐

0. 总结: Class

1. set background color

  1. class: card-panel
  2. 使用方法:
  • class="card-panel teal lighten-2"
  • class="card-panel dark"

2. set text color

  1. class: colorName-text
  2. 使用方法: apply a text color ,just append -text to the color class
  • class="teal-text text-lighten-2"
  • class="dark-text text-darken-2"

3. set the body content's width

  1. class: container
    set the body content's width to the window width of ~xxx%
    .s 90%
    .m 85%
    .l 70%
    .xl 70%
  2. 使用方法:
    <div class="container"> ASD </div>

4. align your content

  1. vertical align
    1.1 class: valign-wrapper
    1.2 使用方法: div class="valign-wrapper">
  2. horizon text align
    2.1 class:
    left-align
    right-align
    center-align
    2.2 使用方法:
<div>
<h5 class="right-align">This should be right aligned</h5>
</div>

5. quickly float things

which is used to avoid specificity issues

  1. class: left, right
  2. 使用方法:
    div class="left">
    div class="right">

***** 分割线 *****


1. Color

  1. background color: class="card-panel teal lighten-2"
  2. text color: class="blue-text text-darken-2"
// Background Color
 <div class="card-panel teal lighten-2">This is a card panel with a teal lighten-2 class</div>
  <div class="card-panel">
// Text color ,To apply a text color, just append  ' -text ' to the color class like this
    <span class="blue-text text-darken-2">This is a card panel with dark blue text</span>
  </div>

2. Grid

  • standard 12 column fluid responsive grid system.
  1. 用 grid 布局网页
  2. container 设置为窗口宽度的 70% ,将网页内容居中。
    The container class is set to ~70% of the window width. It helps you center and contain your page content. We use the container to contain our body content.
  3. grid 网页布局原理:
    无论浏览器多大尺寸,一行grid 就是相同宽度的12 列
  4. 所有的column 必须包含在同一个row 里面,且必须增加class col 到你内部的div 里面来增加这些 column。
  5. offset-s6 意思是偏移 6行
  6. div class="col s7 push-s5" , class="col s5 pull-s7 push 向右推,pull 向左拉
  7. class="section" used for simple top and bottom padding
  8. class="divider" are 1 pixel lines that help break up your content.(水平分割线)

1. columns contained inside a row

<div class="row">
<div class="col s6 "> this div is 6-columns wide on all screen sizes</div>
</div>

2. push and pull

<div class="row">
      <div class="col s7 push-s5"><span class="flow-text">This div is 7-columns wide on pushed to the right by 5-columns.</span></div>
      <div class="col s5 pull-s7"><span class="flow-text">5-columns wide pulled to the left by 7-columns.</span></div>
    </div>
          

3. offset

<div class="row">
<div class="col s3 offset-s6"> 6-columns</div>
<div class="col s3 offset-s6"> <span class="flow-text">6-columns</span></div>
</div>

4. section and divider

<div class="divider"></div>
<div class="section">
<h2>section1<h2>
<p>stuff</p>
</div>
<div class="divider"></div>

5. Promotion Table

3 个等尺寸的div, 定义每个div 的宽度为4-columns

<div class="row">
<div class="col s4">
Promo Content 1 goes heres
</div>
<div class="col s4">
Promo Content 2 goes heres
</div>
<div class="col s4">
Promo Content 3 goes heres
</div>
</div>

6. Side Navigation Layout

<div class="row">
      <div class="col s3">
         Grey navigation panel 
      </div>
      <div class="col s9">
        Teal page content 
      </div>
    </div>

7. create responsive layouts

How to layout elements using our grid system. Show you how to design you layouts so that they look great on all screen sizes.
Screen Sizes

Mobile Devices Tablet Devices Desktop Devices Large Desktop Devices
screen sizes <= 600px <= 600px > 992px > 1200px
class prefix .s .m .l .xl
container width 90% 85% 70% 70%
number of columns 12 12 12 12

where s signifies the screen class-prefix (s = small, m = medium, l = large)

7.1 adding responsiveness

  • 同时适用大屏幕和小屏幕
<div class="row">
      <div class="grid-example col s12"><span class="flow-text">I am always full-width (col s12)</span></div>
      <div class="grid-example col s12 m6"><span class="flow-text">I am full-width on mobile (col s12 m6)</span></div>
    </div>

7.2 Responsive Side Navigation Layout

  <!-- Navbar goes here -->

    <!-- Page Layout here -->
    <div class="row">

      <div class="col s12 m4 l3"> <!-- Note that "m4 l3" was added -->
        <!-- Grey navigation panel

              This content will be:
          3-columns-wide on large screens,
          4-columns-wide on medium screens,
          12-columns-wide on small screens  -->

      </div>

      <div class="col s12 m8 l9"> <!-- Note that "m8 l9" was added -->
        <!-- Teal page content

              This content will be:
          9-columns-wide on large screens,
          8-columns-wide on medium screens,
          12-columns-wide on small screens  -->

      </div>

    </div>

L

相关文章

  • materialize 布局1 --- 背景、文本设置

    https://materializecss.com/material design 配色:https://ma...

  • 3. Flutter - 基础组件 之 Text

    1. Text 属性介绍 Text继承自StatelessWidget,Text 主要通过设置 文本布局 及 文本...

  • flex布局实现css垂直方向居中

    情景:多行文本想在div中垂直居中方案1(设置为table布局): 方案2(设置为flex布局):

  • Android性能优化总结

    布局优化 1、减少布局层级,Constraintlayout、RelativeLayout2、不要设置重复背景3、...

  • TextInputLayout

    1.设置文本框内的hint颜色 TextInputLayout布局里android:textColorHint...

  • day04

    知识要点梳理 1.命名规范 2.背景 3.背景的简写 4.背景吸附 5.背景大小 6.文本颜色 7.文本设置 8....

  • 「时间」@2.23

    1. 手机影视实现页面布局。 2. 基础页面调度四个页面显示。 3. 页面布局文本框设置。 4. 碎片页面设置,按...

  • materialize 使用说明

    1. 命令 下载materialize-css npm install materialize-css@next ...

  • css

    设置背景或者文本颜色 图像背景 重复背景图片 水平和垂直重复背景图片 文本颜色 字体样式

  • Android Dialog踩坑

    1、设置背景透明度 正确方法是设置Dialog背景暗黑度,在设置对话框的布局文件后调用以下代码 错误方法是设置Di...

网友评论

      本文标题:materialize 布局1 --- 背景、文本设置

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