CSS(Cascading Style Sheets)樣式更改——字體設(shè)置Font&邊框Border
前言
上篇文章主要講述了CSS樣式更改中的背景Background,這篇文章我們來(lái)談?wù)勛煮w設(shè)置Font&邊框Border的基礎(chǔ)用法。。
1.字體設(shè)置Font
1).字體系列
- <div style='font-family: sans-serif normal'></div>
- 可用字體:
- Serif
- Sans-serif
- Monospace
- Cursive
- Fantasy
- Times
- Courier
2).字體風(fēng)格
- <div style='font-style:normal'></div>
- 文本傾斜:
- normal 文本正常顯示
- italic 文本斜體顯示
- oblique 文本傾斜顯示
3).字體變形
- <div style='font-variant:small-caps'></div>
- normal 顯示標(biāo)準(zhǔn)字體。
- small-caps 顯示小型大寫(xiě)字母的字體。
4).字體加粗
- <div style='font-weight:normal'></div>
- normal 標(biāo)準(zhǔn)的字符
- bold 粗體字符
- bolder 更粗的字符
- lighter 更細(xì)的字符
- 也可以使用數(shù)字表示,范圍為100~900
5).字體大小
- <div style='font-size:60px'></div>
- smaller 變小
- larger 變大
- length 固定值
- 而且還支持百分比
2.邊框Border
首先說(shuō)一下邊框風(fēng)格,它的風(fēng)格比較多,常用的一般是實(shí)線為主:
- <div style='border-style:none'></div>
- hidden 隱藏邊框
- dotted 點(diǎn)狀邊框
- dashed 虛線邊框
- solid 實(shí)線邊框
- double 雙線邊框
- groove 3D凹槽邊框
- ridge 3D壟狀邊框
- inset 3D inset邊框
- outset 3D outset邊框
- 邊框也有四面,所以也會(huì)有上下左右
- 所以有時(shí)候?yàn)榱烁_定位并修改樣式可以使用:
- border-top-style 上邊框樣式
- border-right-style 右邊框樣式
- border-bottom-style 下邊框樣式
- border-left-style 左邊框樣式
先定義邊框的寬度 風(fēng)格和顏色,然后定義邊框的其它屬性。
1).邊框形狀
- <div style='border-radius:25px;'></div>
2).邊框陰影
- <div style='box-shadow:1px 2px 2px 2px red'></div>
- 參數(shù)含義:
- 邊框各個(gè)方向的大小和顏色
3).邊框圖片
- <div style='border-image:url(1.png) 30 30 10 round'></div>
- 參數(shù)含義:
- 邊框圖片的路徑
- 圖片邊框向內(nèi)偏移
- 圖片邊框的寬度
- 邊框圖像區(qū)域超出邊框的量
- 圖像邊框是否應(yīng)平鋪(repeated)、鋪滿(mǎn)(rounded)或拉伸(stretched)。
參考文檔:W3C官方文檔(CSS篇)
二、總結(jié)
這篇文章主要介紹了CSS樣式更改篇中的字體設(shè)置Font&邊框Border設(shè)置,希望讓大家對(duì)CSS樣式更改有個(gè)簡(jiǎn)單的認(rèn)識(shí)和了解。