---
title: 3.使用CSS變更HTML標籤特性
tags: JavaScript工程師養成直播班
---
## 1.網頁容器介紹
容器特性
網頁的排版都是有關於容器的設計


## 2.CSS Reset 清空瀏覽器預設樣式
CSS Reset 清除樣式
一般都會有預設樣式

如何清除預設樣式
- 逐一覆寫
- [CSS Tools: Reset CSS](https://meyerweb.com/eric/tools/css/reset/)
```
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
```
### CSS Rest後的範例

### 也可個別取消 reset的樣式

### 可在CSS檔後面複寫要改的樣式
先放客製化 再寫上自己設定的CSS樣式 會吃後面的設定
:::info
h1{
color:palevioletred;
font-size: 20px;
}
:::
```
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
h1{
color:palevioletred;
font-size: 20px;
}
```

## 3.區塊元素display:block介紹
區塊元素
- 儘可能佔滿整個版面
- 區塊元素會另起一行進行呈現
-
:::danger
display:block
:::

HTML標籤
H1->區塊元素
P->區塊元素
li->區塊元素
可於CSS設定 color, background 來查看是否為
區塊元素
```
background: blue;
color:white;
```

## 4.行內元素 介紹 display:inline
行內元素常用在段落裡