css字型

zhongta發表於2024-10-04
1.字型分類
SERIF:襯線字型。在字母的主要筆畫末端有額外裝飾。適合長篇文字
SANS_SERIF無襯線字型。文字小的時候運用
MONOSPACE等寬字型。每個字母寬度相同。用於顯示程式碼
CURSIVE:草書字型
FANTASY虛幻字型,用於標題。不適合長篇文字
2.字型選用font-family
<style type="text/css">
			body {
				font-family: Georgia, Times, serif;}
			h1, h2 {
				font-family: Arial, Verdana, sans-serif;}
			.credits {
				font-family: "Courier New", Courier, monospace;}
		</style>
3.字型大小font-size
	<style type="text/css">
			body {
				font-family: Arial, Verdana, sans-serif;
				font-size: 12px;}
			h1 {
				font-size: 200%;}
			h2 {
				font-size: 1.3em;}
		</style>

畫素,百分數,em。
4.用font-face下載字型
<style type="text/css">
			@font-face {
				font-family: 'ChunkFiveRegular';
				src: url('fonts/chunkfive.eot');}
			h1, h2 {
				font-family: ChunkFiveRegular, Georgia, serif;}
		</style>
5.粗體
<style type="text/css">
			.credits {
				font-weight: bold;}
		</style>

normal普通粗細。bold粗體
6.斜體
<style type="text/css">
			.credits {
				font-style: italic;}
		</style>
oblique或italic
7.大小寫
h1 {
				text-transform: uppercase;}
			h2 {
				text-transform: lowercase;}
			.credits {
				text-transform: capitalize;}
uppercase大寫,lowercase小寫,capitalize首字母大寫

8.下劃線或刪除線
.credits {
				text-decoration: underline;}
			a {
				text-decoration: none;}
none,無裝飾線
underline文字下方新增實線
overline文字上方新增實線
line-through穿過文字
blink文字閃爍

相關文章