篇文章主要講述了CSS樣式更改中的背景Background,這篇文章我們來談?wù)勛煮w設(shè)置Font&邊框Border的基礎(chǔ)用法。
<div style='font-family: sans-serif normal'></div>
可用字體:
Serif
Sans-serif
Monospace
Cursive
Fantasy
Times
Courier
<div style='font-style:normal'></div>
文本傾斜:
normal 文本正常顯示
italic 文本斜體顯示
oblique 文本傾斜顯示
<div style='font-variant:small-caps'></div>
normal 顯示標(biāo)準(zhǔn)字體。
small-caps 顯示小型大寫字母的字體。
<div style='font-weight:normal'></div>
normal 標(biāo)準(zhǔn)的字符
bold 粗體字符
bolder 更粗的字符
lighter 更細(xì)的字符
也可以使用數(shù)字表示,范圍為100~900
<div style='font-size:60px'></div>
smaller 變小
larger 變大
length 固定值
而且還支持百分比
首先說一下邊框風(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)格和顏色,然后定義邊框的其它屬性。
<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)、鋪滿(rounded)或拉伸(stretched)。
這篇文章主要介紹了CSS樣式更改篇中的字體設(shè)置Font&邊框Border設(shè)置,希望讓大家對(duì)CSS選擇器有個(gè)簡(jiǎn)單的認(rèn)識(shí)和了解。
****看完本文有收獲?請(qǐng)轉(zhuǎn)發(fā)分享給更多的人****
IT共享之家
想要學(xué)習(xí)更多,請(qǐng)前往Python爬蟲與數(shù)據(jù)挖掘?qū)S镁W(wǎng)站:http://pdcfighting.com/
頁中添加滾動(dòng)字幕效果
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>滾動(dòng)字體的設(shè)置</title>
</head>
<body>
<canvas id="canvas1" width="600" height="600" style="border:1px solid #000000"></canvas>
<script type="text/javascript">
var canvas1 = document.querySelector("#canvas1") // 1.找到畫布對(duì)象
var ctx = canvas1.getContext("2d") // 2.上下文對(duì)象(畫筆)
ctx.shadowBlur = 10; // 陰影距離
ctx.shadowColor = "red" // 陰影顏色
ctx.shadowOffsetX = 30 // 陰影偏移
ctx.shadowOffsetY = 30 // 陰影偏移
ctx.font = "150px 楷體"
ctx.fillText("你好!", 20,150)
ctx.fillText("你好!", 20,350)
ctx.strokeText('你好!',23, 153)
ctx.strokeText('你好',23, 553)
canvas繪制文字
var x = 600
setInterval(function(){
if(x > -350){
//清空畫布
ctx.clearRect(0,0,600,600)
ctx.strokeText('你好!',x, 153)
ctx.fillText("你好!", x,350)
ctx.font = "50px 宋體"
ctx.strokeText('每天學(xué)習(xí)一點(diǎn)點(diǎn)',x, 553)
x -= 3
}else{x=590}
}, 16)
</script>
</body>
</html>
*請(qǐng)認(rèn)真填寫需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。