<style type="text/css"> body i magi adding: Opx font-size: 1 6px; line- height: 180%, underline Style i text-decoration underline verline Style t text-decoration overline text-decoration: line-through; style text-decoration blink. <p class="underline Style">you laugh at me for being different, but I laugh at you for being the same <p class="overline Style">you laugh at me for being different, but I laugh at you for being the same <p class="linethrough Style">you laugh at me for being different, but I laugh at you for being the same <p class="blink Style">you laugh at me for being different, but I laugh at you for being the same. 字体样式 字体样式用来定义字体系列、大小、粗细、显示风格和变形等 2.1CSS支持的字体属性 表11-2字体样式 属性 描述 简写属性。作用是把所有针对字体的属性设置在一个声明中 font-family 设置字体系列 6《网页设计与网站规划》讲稿/河南中医学院互联网应用技术研究所/ht/ bs. 51xueweb cn
6 《网页设计与网站规划》讲稿 / 河南中医学院互联网应用技术研究所 / http://labs.51xueweb.cn <style type="text/css"> body { maigin:50px; padding:0px; font-size:16px; line-height:180%; } .underlineStyle { text-decoration:underline; } .overlineStyle { text-decoration:overline; } .linethroughStyle { text-decoration:line-through; } .blinkStyle { text-decoration:blink; } </style> </head> <body> <p class="underlineStyle">you laugh at me for being different, but I laugh at you for being the same. <p class="overlineStyle">you laugh at me for being different, but I laugh at you for being the same. <p class="linethroughStyle">you laugh at me for being different, but I laugh at you for being the same. <p class="blinkStyle">you laugh at me for being different, but I laugh at you for being the same. </body> </html> 二、字体样式 字体样式用来定义字体系列、大小、粗细、显示风格和变形等。 2.1 CSS 支持的字体属性 表 11-2 字体样式 属性 描述 font 简写属性。作用是把所有针对字体的属性设置在一个声明中。 font-family 设置字体系列
设置字体的尺寸。 font-size-adjust 当首选字体不可用时,对替换字体进行智能缩放。(CS521已删除该属性。) font-stretch 对字体进行水平拉伸。(CSs21已删除该属性。) font-style 设置字体风格。 font-variant 以小型大写字体或者正常字体显示文本。 font-weight 设置字体的粗细 2.2字体系列 在CSS中,有两种不同类型的字体系列 通用字体系列:拥有相似外观的字体系统组合。 特定字体系列:具体的字体系列(比如黑体、微软雅黑、" Times") 除了各种特定的字体系列外,CSS定义了5种通用字体系列: Serf字体 sans- serif字体 Monospace字体 Cursive字体 Fantasy字体 font-family属性用来定义文本的字体系列 该属性值当字体名中有一个或多个空格(比如 New Century Schoolbook),或者如果字体名包括#或$之类的符号,需要在 font- family声明中加引号,单引号或双引号都可。 2.3字体风格 font- style属性用来定义字体的风格,该属性值有三种: normal italic、 oblique。 默认值 normal对文本不做任何改动。 italic定义文本斜体显示。 oblique定义文本倾斜显示。斜体( italic)是一种简单的字体风格, 对每个字母的结构有一些小改动,来反映变化的外观;倾斜( oblique) 文本则是正常竖直文本的一个倾斜版本 2.4字体加粗 font- weight属性用来定义字体的粗细。属性值如下表所示。 7《网页设计与网站规划》讲稿/河南中医学院互联网应用技术研究所/htp/ labs. 51xuewebcn
7 《网页设计与网站规划》讲稿 / 河南中医学院互联网应用技术研究所 / http://labs.51xueweb.cn font-size 设置字体的尺寸。 font-size-adjust 当首选字体不可用时,对替换字体进行智能缩放。(CSS2.1 已删除该属性。) font-stretch 对字体进行水平拉伸。(CSS2.1 已删除该属性。) font-style 设置字体风格。 font-variant 以小型大写字体或者正常字体显示文本。 font-weight 设置字体的粗细。 2.2 字体系列 在 CSS 中,有两种不同类型的字体系列: 通用字体系列:拥有相似外观的字体系统组合。 特定字体系列:具体的字体系列(比如 黑体、微软雅黑、"Times") 除了各种特定的字体系列外,CSS 定义了 5 种通用字体系列: Serif 字体 Sans-serif 字体 Monospace 字体 Cursive 字体 Fantasy 字体 font-family 属性用来定义文本的字体系列。 该属性值当字体名中有一个或多个空格(比如 New Century Schoolbook),或者如果字体名包括#或$之类的符号,需要在 font-family 声明中加引号,单引号或双引号都可。 2.3 字体风格 font-style属性用来定义字体的风格,该属性值有三种:normal、 italic、oblique。 默认值 normal 对文本不做任何改动。italic 定义文本斜体显示。 oblique 定义文本倾斜显示。斜体(italic)是一种简单的字体风格, 对每个字母的结构有一些小改动,来反映变化的外观;倾斜(oblique) 文本则是正常竖直文本的一个倾斜版本。 2.4 字体加粗 font-weight 属性用来定义字体的粗细。属性值如下表所示