使用 CSS 设置关键字的字体大小
CSS font-size 属性可以使用绝对和相对关键字来设置。这会根据需要缩放文本。
语法
CSS font-size 属性的语法如下 –
Selector {
font-size: /*value*/
}
下表列出了 CSS 中使用的标准关键字 –
| Sr.No | Value &描述 |
|---|---|
| 1 | 中
设置字体大小到中等尺寸。这是默认值 |
| 2 | xx-small
集将字体大小设置为 xx-small 尺寸 |
| 3 | x-small< /p>
将字体大小设置为特别小 |
| 4 | 小< /strong>
将字体大小设置为较小尺寸 |
| 5 | large
将字体大小设置为大尺寸 |
| 6 | x-large
将字体大小设置为超大尺寸 |
| 7 | xx-large
将字体大小设置为xx-large尺寸 |
| 8 | 较小
将字体大小设置为小于父元素 |
| 9 | 更大
将字体大小设置为比父元素更大的大小 |
以下示例说明了如何使用关键字设置 CSS font-size 属性。
示例
现场演示
<!DOCTYPE html>
<html>
<head>
<style>
h1{
font-size: larger;
}
#demo {
font-size: medium;
text-align: center;
background-color: floralwhite;
}
p {
font-size: xx-large;
}
</style>
</head>
<body>
<h1>Demo Heading</h1>
<p id=demo>This is demo text.</p>
<p>This is another demo text.</p>
</body>
</html>
输出
这给出了以下输出 –
示例
现场演示
<!DOCTYPE html>
<html>
<head>
<style>
div {
margin: auto;
padding: 5px;
width: 30%;
border: 1px solid;
border-radius: 29%;
text-align: center;
font-size: xx-small;
}
p {
font-size: xx-large;
}
</style>
</head>
<body>
<div>
<div>One</div>
<p>Two</p>
</div>
</body>
</html>
输出
这给出了以下输出 –
以上就是使用 CSS 设置关键字的字体大小的详细内容,更多请关注双恒网络其它相关文章!
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。



