DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> CSS入門知識 >> CSS詳解
CSS文字排版實例大全:打造多變的標題樣式
編輯:CSS詳解     

CSS 功能的強大,本站早已展示過許多案例。關於 CSS 基本的排版控制,雖然已有詳盡的說明與參考教學,但仍有許多豐富的排版技巧鮮少為人知。今天整理的這批實例,能為你打開不少想像與拓展的空間。

h3.reflect_1 { color: #333333; border-bottom: 6px solid #DDDDDD; line-height: .2em; margin: 0; padding:0 0 0 10px; font-size: 150%; }
h3.reflect_2 { color: #CECECE; margin: 0; line-height: .6em; border-top: 1px solid #EEEEEE; padding: 0 0 0 10px; font-size: 150%;}

h3.line_drop { font-family:"Trebuchet MS", Garamond, Georgia; line-height: .88em; border-bottom: #990000 1px solid; color: #990000; letter-spacing: -2px; }

h3.elegant { letter-spacing: -2px; font-family:Georgia, "Times New Roman", Times, serif; font-weight: 100; font-size: 200%; text-shadow: #666666 0.2em 0.2em; }

h3.handwriting { font-style: italic; font-weight: bold; font-family: "Comic Sans MS"; letter-spacing: -1px; font-size: 100%; Word-spacing: .25em; }

以上僅是開場的幾種風格:倒影感的下劃線標題、優雅的陰影襯托、手寫體的斜體字距變化等。你可以藉由 letter-spacing、text-shadow、line-height 與 font-family 的靈活搭配,做出倒影、手寫、報紙頭條、首字下沉、大字距等各種效果。例如報紙風可加上 groove 邊框與 small-caps,首字放大則可用 float 讓大字母環繞文字。

h3.newspaper { letter-spacing: .10em; font-size: 36px; text-transform: uppercase; font-weight: 100; border-bottom: groove 2px #CCCCCC; width: auto; line-height: 1em; }
h3.newspaper span { font-family: Georgia, "Times New Roman", Times, serif; }
h3.scaps { font-variant: small-caps; letter-spacing: -1px; font-size: 200%; font-family: "Courier New", Courier, monospace; font-weight: 100; }
h3.gr { font-size: 500%; margin: 0; float: left; color: #999999; font-family: Impact, Arial, Verdana; text-transform: uppercase; border-bottom: #CC0000 10px solid; font-weight: 100; }

除了標題,段落文字也能玩出花樣。透過調整 line-height 與 letter-spacing 的負值,並搭配 Courier New、Times New Roman、Georgia 等襯線或等寬字體,可以做出緊湊排列的大寫字母群,營造出雜誌或海報般的視覺張力。

p.letters { line-height: .64em; letter-spacing: -2px; font-family: "Courier New", Courier, monospace; font-size: 25px; font-weight: 100; text-transform: uppercase; }
p.tag a { font-size: 85%; text-align: center; color: #FF3300; }
p.tag a:hover { background: #FFFF66; }

若想製作多色彩拼接的標題,可以將每個字母各自包進獨立的 span,再分別指定顏色、字級與 float,就能拼出繽紛活潑的效果。總的來說,這些技巧的核心不脫 font-family、font-size、letter-spacing、line-height、text-transform、text-shadow 與 border 的巧妙組合。掌握它們之後,你也能自由變化出屬於自己的排版風格。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved