偷吃步1
letter-spacing: -0.5px;
但我不愛這招 因為感覺得出來變擠了偷吃步2 用shadow
text-shadow: .25px 0px .1px,
-.25px 0px .1px;
letter-spacing: -0.5px;
但我不愛這招 因為感覺得出來變擠了
text-shadow: .25px 0px .1px,
-.25px 0px .1px;
| 型態選擇器 Type selectors | <h1> <h2> ...<div> <p> |
| ID選擇氣 ID selectors | 使用「#」宣告 一個id在同一個網頁只能出現一次 |
| 類別選擇器 Class selectors | 使用「.」宣告,一個class可以在一個網頁出現多次 |
| 通用選擇器 Universal selector | 使用「*」,*{ }所有元素套用括號內的樣式 |
| 群組選擇器 Groups of selectors | 不用元素擁有同樣的屬性時可以群組設定 |
| 後代選擇器 Descendant combinator | 一個元素之下的所有選擇器為後代選擇器 |
| 子選擇器 Child combinator | 當b元素在a元素下一層時,則b元素為a元素的子選擇器,但若中間有其他元素插入 則只是後代選擇器 |
| 同層相鄰選擇器 Adjacent sibling combinator | 有同一個父親的兩個元素以「+」為連結,選擇某個特定元素之後的第一個特定元素 |
| 同層全體選擇器 General sibling combinator | 有同一個父親的兩個元素以「~」為連結,選擇某個特定元素的同一層元素 |
| 偽類選擇器 Pseudo-classes | 一個元素的特殊狀態,ex滑鼠移至元素上的狀態設定 或一個元素中本來就存在的元素,ex第一個子元素、最後一個子元素 |
| 偽元素選擇器 Pseudo-elements | 被用於指定某個元素的某部分樣式,ex某個樣式的第一個字母、第一行、或其元素之前 之後插入內容 |
| 屬性選擇器 Attribute selectors | 可以為擁有指定屬性的HTML元素設定樣式,不僅限於類別和ID屬性 |
| 新的選擇器 | 偽類選擇器、屬性選擇器、nth選擇器 |
| 區塊模式 | box-sizing有新屬性 定義範圍更直覺 |
| 背景與邊框 | 全螢幕背景、漸層背景、圓角邊框、圖片邊框... |
| 新的圖片屬性 | 圖片陰影、圖片剪裁 |
| 新的文字屬性 | 英文字強失斷行、陰影 |
| 多欄版面配置 | multiple columns |
| 2D/3D變形、動畫 |
| 套用方式 | 優先順序 | |
| 行內樣式 inline style |
直接寫在HTML的元素內
<span class="aaa" style="color:red;"></span>
|
1 |
| 內部樣式 internal style sheet |
直接寫在HTML文件 放在<head>內
<style type="text/css">
加了!important 會變最最優先 無法被行內樣式取代 (也可把important 放在行內樣式中) |
2 |
| 外部樣式 external style sheet |
將所有CSS樣式宣告在其他檔案中 在<head>內
<link href="css/style.css" rel="stylesheet">
| 3 |
| 匯入套用 imported |
可以在html也能在css中 但較常用在css文件內的import
HTML中:
<style type="text/css">
CSS中:
@import url(style.css);
|
| ↑ | ||
| ← | ★ | → |
| ↓ |
| ↓ | ||
| → | ← | |
| ↑ |
| repeat | 重複 預設 |
| repeat-x | 橫向重複(x軸) |
| repeat-y | 縱向重複(y軸) |
| no-repeat | 不重複 |
| scroll | 跟著頁面捲動 預設 |
| fixed | 背景固定 |
| left top left center left bottom right top right center right bottom center top center center center bottom |
直接指定位置 |
| x%,y% | 指定圖片%位置 |
| x px, y px | 指定圖片px位置 |
| none | 無 |
| hidden | 隱藏 |
| dotted |
點線
|
| dashed |
虛線
|
| solid |
實線
|
| double |
雙線
|
| groove |
立體
|
| ridge |
立體
|
| inset |
立體
|
| outset |
立體
|
width:calc(100%/3);
width:calc(600px/3)
width:calc(100%/3+10px);
<p class="blink">這行字會閃 !!!</p>
.blink {
animation-duration: 1s;
animation-name: blink;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: ease-in-out;
}
@keyframes blink {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@keyframes blink {
0% {
opacity: 1;
}
80% {
opacity: 1;
}
81% {
opacity: 0;
}
100% {
opacity: 0;
}
}
background: -ms-linear-gradient(top, #FFF 0%,#81D8D0 100%); /* IE10+ */
background: -webkit-linear-gradient(top, #FFF 0%,#81D8D0 100%); /* Chrome10+,Safari5.1+ */
background: -moz-linear-gradient(top, #FFF 0%, #81D8D0 100%); /* FF3.6+ */
.table-wrap {display:table; width:300px; height:300px; border:solid 1px #ccc; }
.table-cell {display:table-cell; vertical-align:middle; text-align:center;}
<div class="table-wrap">
<div class="table-cell">
<div class="content">
內容置中
</div>
</div>
</div>
vertical-align:middle;
#menuLinkL a {
text-align: center;
width:140px;
height:24px;
line-height:24px;
}
white-space:normal; width:200px;
white-space:normal;
overflow:hidden;
word-wrap: break-word; /*word-wrap 只有fx不支援*/
div{
white-space:nowrap;
div{ word-wrap: break-word; word-break: normal; }
div{ word-break:break-all; }