HTML裡有許多方法可以改變類似p標籤等的文字內容,讓顯示方式更加多元
font-style:italic讓文字呈現斜體
<p style="font-style: italic;">This is a paragraph with bold text.</p>
font-weight:設定字體粗細
font-weight:normal字體默認粗細
font-weight:bolder比父元素粗
font-weight:bold粗體
font-weight:lighter比父元素細
<p style="font-weight:normal">normal</p>
<p style="font-weight:bolder">bolder</p>
<p style="font-weight: bold;">bold</p>
<p style="font-weight: lighter;">lighter</p>
另外font-weight也可以設定數字,可以看到100到500之間沒有任何差別,到600才變粗,這是字型的原因,如果字型當初沒有設計那麼多粗細差別的話,那麼你再怎麼設定也沒有用
<p style="font-weight:100">100</p>
<p style="font-weight:300">300</p>
<p style="font-weight: 500;">500</p>
<p style="font-weight: 600;">600</p>
font-family:改變字形
<p style="font-family: 'Franklin Gothic Medium'">被font-family改字形</p>
font-family可以設定複數字形,當無法找到第一個字形時就會去找第二個
<p style="font-family:'Franklin', 'Courier New'">被font-family改字形</p>
之前在超連結提過text-decoration:none刪除a的底線,其實還能做更多的事情
text-decoration:overline給文字頭部添加邊線
text-decoration:underline;添加底線
text-decoration:line-through;一條線從文字中間橫過
text-decoration-color給text--decoration填色,或是直接在text-decoration打上想要的顏色
<p style="text-decoration: overline violet;">overline</p>
<p style="text-decoration: underline;text-decoration-color:aqua ;">underline</p>
text-decoration-style:裝飾線的樣式
text-decoration-style:solid實線(默認)
text-decoration-style:double雙實線
text-decoration-style:dashed虛線
text-decoration-style:dootted點線
text-decoration-style:wavy波浪
text-decoration-thickness:設定text-decoration的大小,
word-spacing和letter-spacing都是給文字添加間距用的,letter-spacing是給每個英文字母或中文單字都加上空隙,word-spacing是每個單字空隙
<P style="word-spacing: 10px;">Lorem ipsum dolor sit amet consectetur</P>
<p style="letter-spacing: 10px;">Lorem ipsum dolor sit amet consectetur</p>