Materialize CSS

https://materializecss.com/

遇到的问题:

  1. because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
 <link type="text/css" rel="stylesheet" href="../node_modules/materialize-css/dist/css/materialize.min.css"
    media="screen,projection" />
  • 只需要修改 angular.json
    "styles": [
    "src/styles.css",
    "node_modules/materialize-css/dist/css/materialize.min.css"
    ],

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

6. navbar

6.1 设置 navbar 对齐
  1. class:
    <nav><div class="nav-wrapper"></div></nav>
    class="brand-logo center" 设置logo 居中
    <ul class="right"> 设置 navbar links 居中
  2. 使用方法:
<nav>
  <div class="nav-wrapper">
    <a href="#" class="brand-logo center">Logo </a>
    <ul class="right">
        <li><a href="sass.html">Sass</a></li>
        <li><a href="badges.html">Components</a></li>
        <li><a href="collapsible.html">JavaScript</a></li>
    </ul>
  </div>
</nav>
6.2 Active Items
  • 增加类active 到 li 标签表示当前页
  1. class: class="active"
  2. 使用方法:
    <li class="active"><a href="collapsible.html">JavaScript</a></li>
  <nav>
    <div class="nav-wrapper">
      <a href="#!" class="brand-logo center">Logo</a>
      <ul class="left hide-on-med-and-down">
        <li><a href="sass.html">Sass</a></li>
        <li><a href="badges.html">Components</a></li>
        <li class="active"><a href="collapsible.html">JavaScript</a></li>
      </ul>
    </div>
  </nav>
6.3 Extended Navbar with Tabs

要实现增加拓展的组件到 navbar,需要增加 类 nav-extended 到外层的nav tag

  1. class: nav-extended
  2. 使用方法:
<nav class="nav-extended">
    <div class="nav-wrapper">
      <a href="#" class="brand-logo">Logo</a>
</div>
 <div class="nav-content">
      <ul class="tabs tabs-transparent">
        <li class="tab"><a href="#test1">Test 1</a></li>
        <li class="tab"><a class="active" href="#test2">Test 2</a></li>
        <li class="tab disabled"><a href="#test3">Disabled Tab</a></li>
        <li class="tab"><a href="#test4">Test 4</a></li>
      </ul>
    </div>
</nav>
6.4 Fixed Navbar
  1. To make the navbar fixed , you have to add an outer wrapping div with the class navbar-fixed.
  2. This will offset your other content while making your nav fixed.
  3. You can adjust the height of this outer div to change how much offset is on your content.
  4. class: navbar-fixed
  5. 使用方法:
<div class="navbar-fixed">
    <nav>
      <div class="nav-wrapper">
        <a href="#!" class="brand-logo">Logo</a>
        <ul class="right hide-on-med-and-down">
          <li><a href="sass.html">Sass</a></li>
          <li><a href="badges.html">Components</a></li>
        </ul>
      </div>
    </nav>
  </div>
6.5 Navbar 下拉菜单
  1. To add a navbar dropdown menu, add the ul dropdown structure into the page.
  2. Add an element to trigger the dropdown menu
  3. Make sure to supply the id of the dropdown structure to the data-target attribute of the dropdown trigger.
  4. class: navbar-fixed
  5. 使用方法:
---

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

---

## 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.(水平分割线)
> 9. 

  





### 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

<!-- 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
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 215,634评论 6 497
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,951评论 3 391
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 161,427评论 0 351
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,770评论 1 290
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,835评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,799评论 1 294
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,768评论 3 416
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,544评论 0 271
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,979评论 1 308
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,271评论 2 331
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,427评论 1 345
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,121评论 5 340
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,756评论 3 324
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,375评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,579评论 1 268
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,410评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,315评论 2 352

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,322评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,460评论 0 23
  • “嘟~嘟~”电话不合时宜的响了起来! “喂,您好!”张弓长强压着吃了两个客户大鳖的怒火,礼貌性的问到。 “小张啊~...
    小白沐春风阅读 1,395评论 10 10
  • 城市的街角, 我看到了独自徘徊的我, 我想去叫住自己, 却发现自己听不到。 擦肩而过,熟悉却陌生, 迷失了,迷失的...
    Lucifer83阅读 733评论 0 50
  • 安静的,一朵花来了 打扰了整座森林 有孤寂,有欢腾 有渐渐的枯败
    木言寺阅读 187评论 0 0