文字屬性和字型屬性

2022-09-06 03:33:07 字數 1856 閱讀 7089

編輯本部落格

font-size: 20px;

font-weight: bolder;

font-family: "microsoft yahei ui","微軟雅黑","arial",sans-serif;

text-align: center;
清除a標籤樣式

text-decoration: none;
行高設定和盒子一樣的高度文字將垂直居中顯示

line-height: 150px;
仿造a標籤,滑鼠移動上去顯示小手狀態

cursor: pointer;
將line-height:盒子高度;

通過對父級元素設定padding屬性來控制

padding-top=(盒子高度-(行高+字型大小)*行數)/2

備選字型可以用逗號分隔設定多個

font-size: 15px;

line-height: 20px;

font-family: "宋體";

/*上面三行等價於下面一行

*/font: 15px/20px "宋體";

設定首行文字縮排,單位通常用em單位,1em等於乙個字型大小。

text-indent: 2em;

doctype html

>

<

html

lang

="en"

>

<

head

>

<

meta

charset

="utf-8"

>

<

title

>超連結美化

title

>

<

style

type

="text/css"

>

*.bar

/*.bar:after

*/ul li

.bar ul li

/*a標籤不繼承父元素的color屬性

*/.bar ul li a

.bar ul li a:hover

style

>

head

>

<

body

>

<

div

class

="bar"

>

<

ul>

<

li><

a href

="#"

>**導航

a>

li>

<

li><

a href

="#"

>**導航

a>

li>

<

li><

a href

="#"

>**導航

a>

li>

<

li><

a href

="#"

>**導航

a>

li>

<

li><

a href

="#"

>**導航

a>

li>

<

li><

a href

="#"

>**導航

a>

li>

ul>

div>

body

>

html

>

view code

字型屬性 文字屬性

font family 微軟雅黑 字型 font size 16px 瀏覽器預設大小 16px 字型大小大小 font weight 400代表正常 700代表加粗 字型粗細 font style normal 預設正常 italic 斜體 文字樣式 字型復合屬性 順序 swsf font font...

前端 文字屬性和字型屬性

介紹幾個常用的。文字對齊 text align 屬性規定元素中的文字的水平對齊方式。屬性值 none center left right justify 文字顏色 color屬性 文字首行縮排 text indent 屬性規定元素首行縮排的距離,單位建議使用em 文字修飾 text decorati...

17 文字屬性和字型屬性

介紹幾個常用的。文字對齊 text align 屬性規定元素中的文字的水平對齊方式。屬性值 none center left right justify 文字顏色 color屬性 文字首行縮排 text indent 屬性規定元素首行縮排的距離,單位建議使用em 文字修飾 text decorati...