可規定元素內部的行間距,接受長度單位或百分比。
屬性名稱:line-height 屬性值:normal | <number> | <length> | <percentage> 初始值:normal 適用對象:所有元素 是否繼承:是 百分比基準:依元素的字型大小而定
以下三種寫法表達方式不同,結果一致:
DIV { line-height:1.2; font-size:10pt }
DIV { line-height:1.2em; font-size:10pt }
DIV { line-height:120%; font-size:10pt }
屬性名稱:vertical-align
屬性值:baseline | sub | super | top | text-top | middle |
bottom | text-bottom | <percentage> | <length>
初始值:baseline
適用對象:行內元素
是否繼承:否
百分比基準:依元素的 line-height 而定
各值意義:
屬性名稱:visibility 屬性值:visible | hidden | collapse 初始值:inherit 適用對象:所有元素 是否繼承:若值為 inherit,則繼承父元素屬性 百分比:不適用
實務上要區分 visibility:hidden 與 display:none:前者隱藏元素但保留其佔用的空間,後者則連版面位置一起移除。