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

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

语法:

font:[ [ <font-style>|| <font-weight>][ <font-size><font-family>]

默认值:看独立属性自身

取值:

<font-style>:

指定文本字体样式

<font-variant>:

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

<font-weight>:

指定文本字体的粗细

<font-size>:

指定文本字体尺寸

<line-height>:

指定文本字体的行高

<font-family>:

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

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

<!DOCTYPE html>

<html lang="zh-cn">

<head>

<meta charset="utf-8" />

<title>font_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样式表来修饰字体。


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

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

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-20
下一篇 2023-03-20

发表评论

登录后才能评论

评论列表(0条)

保存