text-indent: <length> | <percentage>;
2em ≈ 兩個漢字寬)。0。p { text-indent: 2em; }
配合 <p> 標籤,全站文章自動首行縮進,排版規範、可讀性佳。
.hanging {
padding-left: 2em;
text-indent: -2em;
}
第一行往左突出,後續行縮進,適合參考文獻、清單項目。
.article-content p { text-indent: 2em; }
/* 或 */
.article-content > * + * { text-indent: 2em; } /* 非首段縮進,首段不縮(書刊慣例) */
僅針對 p、h1-h6、li 等區塊級語意元素設定,勿全域 *{text-indent:2em} 導致按鈕、輸入框異常。
全瀏覽器支援(含 IE5.5+),極度安全。
2em 首行縮進。margin-bottom: 1em)分隔。text-indent: 2em 會隨字體大小自動調整,優於固定 px。