在html中,用于设置字体格式的标记有哪些 您所在的位置:网站首页 html预设格式标记 在html中,用于设置字体格式的标记有哪些

在html中,用于设置字体格式的标记有哪些

2023-03-22 12:55| 来源: 网络整理| 查看: 265

语法:

font:[ [ font-style|| font-weight][ font-sizefont-family]

默认值:看独立属性自身

取值:

font-style:

指定文本字体样式

font-variant:

指定文本是否为小型的大写字母

font-weight:

指定文本字体的粗细

font-size:

指定文本字体尺寸

line-height:

指定文本字体的行高

font-family:

指定文本使用某个字体或字体序列

这是一段修饰文字的代码:

!DOCTYPE html

html lang="zh-cn"

head

meta charset="utf-8" /

titlefont_CSS参考手册_web前端开发参考手册系列/title

meta name="author" content="Joy Du(飘零雾雨), [email protected]" /

meta name="copyright" content="www.doyoe.com" /

style

.test p{margin:15px 0border:1px solid #000}

.font1 p{font:18px Simsun,arial,sans-serif}

.font2 p{font:italic 18px Simsun,arial,sans-serif}

.font3 p{font:italic small-caps 18px Simsun,arial,sans-serif}

.font4 p{font:italic small-caps bold 18px Simsun,arial,sans-serif}

.font5 p{font:italic small-caps bold 18px/2 Simsun,arial,sans-serif}

.caption p{font:caption}

.icon p{font:icon}

.menu p{font:menu}

.message-box p{font:message-box}

.small-caption p{font:small-caption}

.status-bar p{font:status-bar}

/style

/head

body

ul class="test"

li class="font1"

strong只指定字体大小和字体:/strong

p本段文字将显示为18px宋体。/p

/li

li class="font2"

strong只指定字体样式、大小和字体:/strong

p本段文字将显示为斜体的18px宋体。/p

/li

li class="font3"

strong只指定字体样式、小型大写字母、大小和字体:/strong

p本段文字将显示为斜体的带小型大写字母的18px宋体。大小型大写字母对比:AaBbCcDdEeFfGg/p

/li

li class="font4"

strong只指定字体样式、小型大写字母、粗细、大小和字体:/strong

p本段文字将显示为斜体的带小型大写字母的加粗18px宋体。/p

/li

li class="font5"

strong只指定字体样式、小型大写字母、粗细、大小、行高和字体:/strong

p本段文字将显示为行高为2的斜体的带小型大写字母的加粗18px宋体。/p

/li

li class="caption"

strong指定字体为caption:/strong

p本段文字将以caption的字体显示。/p

/li

li class="icon"

strong指定字体为icon:/strong

p本段文字将以icon的字体显示。/p

/li

li class="menu"

strong指定字体为menu:/strong

p本段文字将以menu的字体显示。/p

/li

li class="message-box"

strong指定字体为message-box:/strong

p本段文字将以message-box的字体显示。/p

/li

li class="small-caption"

strong指定字体为small-caption:/strong

p本段文字将以small-caption的字体显示。/p

/li

li class="status-bar"

strong指定字体为status-bar:/strong

p本段文字将以status-bar的字体显示。/p

/li

/ul

/body

/html

复制上面这段代码编辑成.html格式文件用浏览器打开即可查看文字属性信息,如果没有编辑软件那就使用记事本编辑保存文件后缀为.html打开即可

html语言最开始只是针对文字的,字体设置的标记有很多:

B粗体/B 粗体

I斜体/I 斜体

U底线/U 底线

SUP上标/SUP 上标

SUB下标/SUB 下标

TT打字机/TT 打字机

BLINK闪烁/BLINK 闪烁

EM强调/EM 强调

STRONG加强/STRONG 加强

SAMP范例/SAMP 范例

CODE原始码/CODE 原始码

VAR参数/VAR 参数

DFN定义/DFN 定义

CITE引用/CITE 引用

ADDRESS所在地址/ADDRESS 所在地址

H1标题/H1

现在大多都不用这些标签了,而是使用css样式表来修饰字体。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://outofmemory.cn/zaji/6306999.html



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有