| 名稱 | CSS 性質 | 描述 |
|---|---|---|
| display | display | 元素呈現方式 |
| color | color | 字型顏色 |
| fontFamily | font-family | 字型種類 |
| fontWeight | font-weight | 字型粗細 |
| fontSize | font-size | 字型尺寸 |
| fontStyle | font-style | 字型格式 |
| fontVariant | font-variant | 字型變體 |
| fontStretch | font-stretch | 字型伸縮 |
| fontSizeAdjust | font-size-adjust | 字型大小 |
| font | font | 字型 |
| textIndent | text-indent | 文字縮排 |
| textAlign | text-align | 水平對齊 |
| lineHeight | line-height | 文字行高 |
| verticalAlign | vertical-align | 垂直對齊 |
| wordSpacing | word-spacing | 單字間距 |
| letterSpacing | letter-spacing | 字元間距 |
| textTransform | text-transform | 大小寫轉換 |
| textDecoration | text-decoration | 文字裝飾 |
| textShadow | text-shadow | 文字陰影 |
| whiteSpace | white-space | 空白字元 |
| direction | direction | 文字方向 |
| width | width | 寬度 |
| height | height | 高度 |
| margin | margin | 邊界 |
| marginLeft | margin-left | 左邊界 |
| marginRight | margin-right | 右邊界 |
| marginTop | margin-top | 上邊界 |
| marginBottom | margin-bottom | 下邊界 |
| padding | padding | 邊距 |
| paddingLeft | padding-left | 左邊距 |
| paddingRight | padding-right | 右邊距 |
| paddingTop | padding-top | 上邊距 |
| paddingBottom | padding-bottom | 下邊距 |
| borderStyle | border-style | 邊框格式 |
| borderLeftStyle | border-left-style | 左邊框格式 |
| borderRightStyle | border-right-rtyle | 右邊框格式 |
| borderTopStyle | border-top-style | 上邊框格式 |
| borderBottomStyle | border-bottom-style | 下邊框格式 |
| borderWidth | border-width | 邊框粗細 |
| borderLeftWidth | border-left-width | 左邊框粗細 |
| borderRightWidth | border-right-width | 右邊框粗細 |
| borderTopWidth | border-top-width | 上邊框粗細 |
| borderBottomWidth | border-bottom-width | 下邊框粗細 |
| borderColor | border-color | 邊框顏色 |
| borderLeftColor | border-left-color | 左邊框顏色 |
| borderRightColor | border-right-color | 右邊框顏色 |
| borderTopColor | border-top-color | 上邊框顏色 |
| borderBottomColor | border-bottom-color | 下邊框顏色 |
| border | border | 邊框 |
| borderLeft | border-left | 左邊框 |
| borderRight | border-right | 右邊框 |
| borderTop | border-top | 上邊框 |
| borderBottom | border-bottom | 下邊框 |
| background | background | 背景 |
| backgroundColor | background-color | 背景顏色 |
| backgroundImage | background-image | 背景圖片 |
| backgroundRepeat | background-repeat | 重複背景圖片 |
| backgroundPosition | background-position | 背景位置 |
| backgroundAttachment | background-attachment | 背景固定 |
| cssFloat | float | 浮動 |
| clear | clear | 清除 |
| position | position | 定位 |
| top | top | 對頂端位移 |
| right | right | 對右端位移 |
| bottom | bottom | 對底部位移 |
| left | left | 對左端位移 |
| minWidth | min-width | 最小寬度 |
| maxWidth | max-width | 最大寬度 |
| minHeight | min-height | 最小高度 |
| maxHeight | max-height | 最大高度 |
| overflow | overflow | 溢出 |
| clip | clip | 剪裁 |
| visibility | visibility | 可見性 |
| zIndex | z-index | 重疊順序 |
| captionSide | caption-side | 表格標題 |
| borderCollapse | border-collapse | 儲存格邊框 |
| borderSpacing | border-spacing | 儲存格邊距 |
| emptyCells | empty-cells | 空白儲存格 |
| tableLayout | table-layout | 表格外觀 |
| listStyle | list-style | 項目符號 |
| listStyleType | list-style-type | 符號類型 |
| listStyleImage | list-style-image | 符號圖片 |
| listStylePosition | list-style-position | 清單符號位置 |
| content | content | 自訂內容 |
| counterReset | counter-reset | 重設編號 |
| counterIncrement | counter-increment | 編號計數 |
| quotes | quotes | 引號 |
| cursor | cursor | 滑鼠游標 |
| outline | outline | 外框 |
| outlineStyle | outline-style | 外框格式 |
| outlineWidth | outline-width | 外框粗細 |
| outlineColor | outline-color | 外框顏色 |
舉例如下
function run1(d) {
d.style.background = "white";
d.style.color = "black";
}
function run2(d) {
d.style.background = "black";
d.style.color = "white";
}
/* 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:style001.js
功能:示範 JavaScript 程式
作者:張凱慶
時間:西元 2011 年 8 月 */此例中的 run1() 將文字設定成白色,背景設定為黑色
function run1(d) {
d.style.background = "white";
d.style.color = "black";
}run2() 則相反,也就是文字設定成黑色,背景設定為白色。
我們以下面的 HTML 文件載入
<!DOCTYPE html>
<html>
<head>
<title>HTML DOM DEMO</title>
<script src="style001.js" type="text/javascript"></script>
<style>
#demo {
width: 108px;
}
</style>
</head>
<body>
<div id="demo" onmouseover="run2(this);"
onmouseout="run1(this);">
There is no spoon.</div>
</body>
</html>
<!-- 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:style001.html
功能:示範 JavaScript 程式
作者:張凱慶
時間:西元 2011 年 8 月 -->瀏覽器 (browser) 開啟,滑鼠移動文字上就會動態變成黑底白字

| 中英文術語對照 | |
|---|---|
| 性質 | property |
| 物件 | object |
| 屬性 | attribute |
| 瀏覽器 | broswer |
您可以繼續參考
CSS 2.1 快速導覽
樣式設定物件 style
- 元素呈現方式 display
- 文字相關
- 字型顏色 color
- 字型種類 fontFamily
- 字型粗細 fontWeight
- 字型尺寸 fontSize
- 字型格式 fontStyle
- 字型變體 fontVariant
- 字型伸縮 fontStretch
- 字型大小 fontSizeAdjust
- 字型 font
- 文字縮排 textIndent
- 水平對齊 textAlign
- 文字行高 lineHeight
- 垂直對齊 verticalAlign
- 單字間距 wordSpacing
- 字元間距 letterSpacing
- 大小寫轉換 textTransform
- 文字裝飾 textDecoration
- 文字陰影 textShadow
- 空白字元 whiteSpace
- 文字方向 direction
- 區塊相關
- 寬度 width
- 高度 height
- 邊界 margin
- 左邊界 marginLeft
- 右邊界 marginRight
- 上邊界 marginTop
- 下邊界 marginBottom
- 邊距 padding
- 左邊距 paddingLeft
- 右邊距 paddingRight
- 上邊距 paddingTop
- 下邊距 paddingBottom
- 邊框格式 borderStyle
- 左邊框格式 borderLeftStyle
- 右邊框格式 borderRightStyle
- 上邊框格式 borderTopStyle
- 下邊框格式 borderBottomStyle
- 邊框粗細 borderWidth
- 左邊框粗細 borderLeftWidth
- 右邊框粗細 borderRightWidth
- 上邊框粗細 borderTopWidth
- 下邊框粗細 borderBottomWidth
- 邊框顏色 borderColor
- 左邊框顏色 borderLeftColor
- 右邊框顏色 borderRightColor
- 上邊框顏色 borderTopColor
- 下邊框顏色 borderBottomColor
- 邊框 border
- 左邊框 borderLeft
- 右邊框 borderRight
- 上邊框 borderTop
- 下邊框 borderBottom
- 背景相關
- 背景 background
- 背景顏色 backgroundColor
- 背景圖片 backgroundImage
- 重複背景圖片 backgroundRepeat
- 背景位置 backgroundPosition
- 背景固定 backgroundAttachment
- 定位相關
- 浮動 cssFloat
- 清除 clear
- 定位 position
- 對頂端位移 top
- 對右端位移 right
- 對底部位移 bottom
- 對左端位移 left
- 最小寬度 minWidth
- 最大寬度 maxWidth
- 最小高度 minHeight
- 最大高度 maxHeight
- 溢出 overflow
- 剪裁 clip
- 可見性 visibility
- 重疊順序 zIndex
- 表格
- 清單
- 自訂內容 content
- 引號 quotes
- 滑鼠游標 cursor
- 外框 outline
相關目錄
HTML DOM 快速導覽
JavaScript 教材
首頁
參考資料
https://developer.mozilla.org/en/DOM/CSS
https://developer.mozilla.org/en/DOM/element.style
https://developer.mozilla.org/en/DOM/HTMLStyleElement
沒有留言:
張貼留言