CSS樣式更改——字體設置Font&邊框Border


上篇文章主要講述了CSS樣式更改中的背景Background,這篇文章我們來談談字體設置Font&邊框Border的基礎用法。

1.字體設置Font

1).字體系列

<div style='font-family: sans-serif normal'></div>
可用字體:
Serif
Sans-serif
Monospace
Cursive
Fantasy
Times
Courier

2).字體風格

<div style='font-style:normal'></div>
文本傾斜:
normal   文本正常顯示
italic   文本斜體顯示
oblique  文本傾斜顯示

3).字體變形

<div style='font-variant:small-caps'></div>
normal 			顯示標准字體。
small-caps      顯示小型大寫字母的字體。

4).字體加粗

<div style='font-weight:normal'></div>
normal    標准的字符
bold      粗體字符
bolder    更粗的字符
lighter   更細的字符
也可以使用數字表示,范圍為100~900

5).字體大小

<div style='font-size:60px'></div>
smaller 變小
larger  變大
length  固定值
而且還支持百分比

2.邊框Border

首先說一下邊框風格,它的風格比較多,常用的一般是實線為主:

<div style='border-style:none'></div>
hidden     隱藏邊框
dotted     點狀邊框
dashed     虛線邊框
solid      實線邊框
double     雙線邊框
groove     3D凹槽邊框
ridge      3D壟狀邊框
inset      3D inset邊框
outset     3D outset邊框
邊框也有四面,所以也會有上下左右
所以有時候為了更精確定位並修改樣式可以使用:
border-top-style     上邊框樣式
border-right-style   右邊框樣式
border-bottom-style  下邊框樣式
border-left-style    左邊框樣式

先定義邊框的寬度 風格和顏色,然后定義邊框的其它屬性。

1).邊框形狀

<div style='border-radius:25px;'></div>

2).邊框陰影

<div style='box-shadow:1px 2px 2px 2px red'></div>
參數含義:
邊框各個方向的大小和顏色

3).邊框圖片

<div style='border-image:url(1.png) 30 30 10 round'></div>
參數含義:
邊框圖片的路徑
圖片邊框向內偏移
圖片邊框的寬度
邊框圖像區域超出邊框的量
圖像邊框是否應平鋪(repeated)、鋪滿(rounded)或拉伸(stretched)。

總結

這篇文章主要介紹了CSS樣式更改篇中的字體設置Font&邊框Border設置,希望讓大家對CSS選擇器有個簡單的認識和了解。
看完本文有收獲?請轉發分享給更多的人

IT共享之家

想要學習更多,請前往Python爬蟲與數據挖掘專用網站:http://pdcfighting.com/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM