怎么在html中设置字体的属性

发布时间:2022-04-27 17:08:20 作者:iii
来源:亿速云 阅读:349

这篇“怎么在html中设置字体的属性”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“怎么在html中设置字体的属性”文章吧。

html中设置字体的属性:font、font-family、font-size、font-style、font-variant、font-weight、“@font-face”、font-size-adjust、font-stretch。

字体属性定义字体,加粗,大小,文字样式。

html中设置字体的属性

属性说明
font在一个声明中设置所有字体属性
font-family规定文本的字体系列
font-size规定文本的字体尺寸
font-style规定文本的字体样式
font-variant规定文本的字体样式。设置小型大写字母的字体显示文本,这意味着所有的小写字母均会被转换为大写,但是所有使用小型大写字体的字母与其余文本相比,其字体尺寸更小。
font-weight规定字体的粗细
@font-face一个规则,允许网站下载并使用其他超过"Web- safe"字体的字体
font-size-adjust为元素规定 aspect 值。为某个元素规定一个 aspect 值,这样就可以保持首选字体的 x-height。
font-stretch收缩或拉伸当前的字体系列。对当前的 font-family 进行伸缩变形。所有主流浏览器都不支持。

扩展资料:

在HTML/CSS中,有两种类型的字体系列名称:

Generic family字体系列说明
SerifTimes New Roman
Georgia
Serif字体中字符在行的末端拥有额外的装饰
Sans-serifArial
Verdana
"Sans"是指无 - 这些字体在末端没有额外的装饰
MonospaceCourier New
Lucida Console
所有的等宽字符具有相同的宽度

font-family 属性应该设置几个字体名称作为一种"后备"机制,如果浏览器不支持第一种字体,他将尝试下一种字体。

注意: 如果字体系列的名称超过一个字,它必须用引号,如Font Family:"宋体"。

多个字体系列是用一个逗号分隔指明:

p{font-family:"Times New Roman", Times, serif;}

下面是一些常用的字体组合,通用的字体系列。

Serif 字体

字体文本示例
Georgia, serif

This is a heading

This is a paragraph

"Palatino Linotype", "Book Antiqua", Palatino, serif

This is a heading

This is a paragraph

"Times New Roman", Times, serif

This is a heading

This is a paragraph

sans - serif字体

字体文本示例
Arial, Helvetica, sans-serif

This is a heading

This is a paragraph

Arial Black, Gadget, sans-serif

This is a heading

This is a paragraph

"Comic Sans MS", cursive, sans-serif

This is a heading

This is a paragraph

Impact, Charcoal, sans-serif

This is a heading

This is a paragraph

"Lucida Sans Unicode", "Lucida Grande", sans-serif

This is a heading

This is a paragraph

Tahoma, Geneva, sans-serif

This is a heading

This is a paragraph

"Trebuchet MS", Helvetica, sans-serif

This is a heading

This is a paragraph

Verdana, Geneva, sans-serif

This is a heading

This is a paragraph

Monospace 字体

字体文本示例
"Courier New", Courier, monospace

This is a heading

This is a paragraph

"Lucida Console", Monaco, monospace

This is a heading

This is a paragraph

以上就是关于“怎么在html中设置字体的属性”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注亿速云行业资讯频道。

推荐阅读:
  1. html如何设置字体
  2. html在图片上设置字体的方法

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

html

上一篇:如何在html中停止audio

下一篇:HTML页面中点击下载文件的方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》