主講: 王裕佳
Material Design 1 (2014)
建立基礎,以「紙與墨水」的物理特性為隱喻。
Material Design 2 (2018) 引入 Material Theming,
讓品牌能更自由地客製化形狀與顏色。
Material Design 3 / Material You (2021~)
強調「個人化」與「無障礙」
個人化: (n) Personalization [ˋpɝsnəlˌaɪz]
無障礙: (n) Accessibility [ˌæksɛsəˋbɪlətɪ]
(中間11個字母簡稱 A11y)
隱喻: (n) Metaphor [ˋmɛtəfɚ]
排版學: (n.) Typography [taɪˋpɑgrəfɪ]
網格: (n.) Grids [daɪˋnæmɪk]
◀ Ripple Effect
適應的: (adj) Adaptive [əˋdæptɪv]
動態的: (adj) Dynamic [daɪˋnæmɪk]
第三的: (adj.) Tertiary [ˋtɝʃɪ͵ɛrɪ]
高度: (n) Elevation [͵ɛləˋveʃən]
<M2
M3>
(色/音)調: (n) Tonal [ˈtonḷ]
升高的: (a) Elevated [ ˋɛlə͵vetɪd ]
輪廓: (a) Outlined [ˋaʊt͵laɪnd]
Navigation Bar:
適合手機端,3-5 個主要目的地的快速切換
Navigation Rail: 適合平板與桌面端,位於畫面左側
Navigation Drawer:
漢堡選單,用於隱藏超過 5 個的次要導覽項目。
Dialogs: 要求做出決定或確認重要訊息。
m3.material.io (所有的設計指南與規範都在這裡)編輯程式碼:在桌面 app.html 右鍵 開啟檔案 Visual Studio Code
檢視作品:在桌面 app.html 右鍵 開啟檔案 Google Chrome / Microsoft Edge
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>系統控制</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet">
<script type="importmap">
{ "imports": { "@material/web/": "https://esm.run/@material/web/" } }
</script>
<script type="module"> import '@material/web/all.js'; </script>
<style>
:root {
/* 顏色系統 */
--md-sys-color-primary: #D0BCFF;
--md-sys-color-on-primary: #381E72;
--md-sys-color-surface: #1C1B1F;
--md-sys-color-on-surface: #E6E1E5;
--md-sys-color-surface-container: #211F26;
--md-sys-color-outline: #938F99;
--md-sys-color-secondary-container: #4A4458;
--md-sys-color-on-secondary-container: #E8DEF8;
font-family: 'Roboto', sans-serif;
}
body {
margin: 0;
background-color: var(--md-sys-color-surface);
color: var(--md-sys-color-on-surface);
display: flex;
height: 100vh;
}
aside {
width: 80px;
border-right: 1px solid var(--md-sys-color-outline);
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 0;
gap: 12px;
}
main {
flex-grow: 1;
padding: 32px;
overflow-y: auto;
}
</style>
</head>
<body>
<aside>
<md-icon-button><span class="material-symbols-outlined">menu</span></md-icon-button>
</aside>
<main>
<h1 class="md-typescale-display-medium">系統控制</h1>
</main>
</body>
</html>◀ 程式碼
Tab
Divider
Card
Switch
Checkbox
Chip
Slider
Text Field
Button
到 https://material-web.dev 尋找文檔
以 Tab 為例,用法為:
<md-tabs>
<md-primary-tab>Video</md-primary-tab>
<md-primary-tab>Photos</md-primary-tab>
<md-primary-tab>Audio</md-primary-tab>
</md-tabs>
<md-tabs>
<md-secondary-tab>Birds</md-secondary-tab>
<md-secondary-tab>Cats</md-secondary-tab>
<md-secondary-tab>Dogs</md-secondary-tab>
</md-tabs>插入到你的程式碼:
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>系統控制</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet">
<script type="importmap">
{ "imports": { "@material/web/": "https://esm.run/@material/web/" } }
</script>
<script type="module"> import '@material/web/all.js'; </script>
<style>
:root {
/* 顏色系統 */
--md-sys-color-primary: #D0BCFF;
--md-sys-color-on-primary: #381E72;
--md-sys-color-surface: #1C1B1F;
--md-sys-color-on-surface: #E6E1E5;
--md-sys-color-surface-container: #211F26;
--md-sys-color-outline: #938F99;
--md-sys-color-secondary-container: #4A4458;
--md-sys-color-on-secondary-container: #E8DEF8;
font-family: 'Roboto', sans-serif;
}
body {
margin: 0;
background-color: var(--md-sys-color-surface);
color: var(--md-sys-color-on-surface);
display: flex;
height: 100vh;
}
aside {
width: 80px;
border-right: 1px solid var(--md-sys-color-outline);
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 0;
gap: 12px;
}
main {
flex-grow: 1;
padding: 32px;
overflow-y: auto;
}
</style>
</head>
<body>
<aside>
<md-icon-button>
<span class="material-symbols-outlined">menu</span>
</md-icon-button>
</aside>
<main>
<h1 class="md-typescale-display-medium">系統控制</h1>
<md-tabs>
<md-primary-tab>概覽</md-primary-tab>
<md-primary-tab>數據分析</md-primary-tab>
<md-primary-tab>安全性</md-primary-tab>
</md-tabs>
</main>
</body>
</html>◀ 跳過關卡複製區
找不到的元件1
藏在 GitHub 的 Divider:
<md-divider></md-divider>找不到的元件2
不支援 Web 的元件 Cards:
.card {
background-color: var(--md-sys-color-surface-container);
border-radius: 24px;
padding: 24px;
border: 1px solid var(--md-sys-color-outline);
}
.dashboard-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 24px;
margin-top: 32px;
}手搓樣式:
◀ 卡片
◀ 網格
找不到的元件2
插入卡片:
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>系統控制</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet">
<script type="importmap">
{ "imports": { "@material/web/": "https://esm.run/@material/web/" } }
</script>
<script type="module"> import '@material/web/all.js'; </script>
<style>
:root {
/* 顏色系統 */
--md-sys-color-primary: #D0BCFF;
--md-sys-color-on-primary: #381E72;
--md-sys-color-surface: #1C1B1F;
--md-sys-color-on-surface: #E6E1E5;
--md-sys-color-surface-container: #211F26;
--md-sys-color-outline: #938F99;
--md-sys-color-secondary-container: #4A4458;
--md-sys-color-on-secondary-container: #E8DEF8;
font-family: 'Roboto', sans-serif;
}
body {
margin: 0;
background-color: var(--md-sys-color-surface);
color: var(--md-sys-color-on-surface);
display: flex;
height: 100vh;
}
aside {
width: 80px;
border-right: 1px solid var(--md-sys-color-outline);
display: flex;
flex-direction: column;
align-items: center;
padding: 12px 0;
gap: 12px;
}
main {
flex-grow: 1;
padding: 32px;
overflow-y: auto;
}
.card {
background-color: var(--md-sys-color-surface-container);
border-radius: 24px;
padding: 24px;
border: 1px solid var(--md-sys-color-outline);
}
.dashboard-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 24px;
margin-top: 32px;
}
</style>
</head>
<body>
<aside>
<md-icon-button>
<span class="material-symbols-outlined">menu</span>
</md-icon-button>
</aside>
<main>
<h1 class="md-typescale-display-medium">系統控制</h1>
<md-tabs>
<md-primary-tab>概覽</md-primary-tab>
<md-primary-tab>數據分析</md-primary-tab>
<md-primary-tab>安全性</md-primary-tab>
</md-tabs>
<md-divider></md-divider>
<div class="dashboard-grid">
<section class="card">
</section>
<section class="card">
</section>
<section class="card">
</section>
</div>
</main>
</body>
</html>◀ 跳過關卡複製區
▲ 在寬螢幕能平分空間
在同一行顯示:
.row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }h2 { margin: 0 0 20px 0; font-size: 1.4rem; color: var(--md-sys-color-primary); }使用方式:
<div class="row">
<div>h2 使用主要顏色:
<span class="md-typescale-body-large">高效能模式</span>自己動手做
元件說明文字: