For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/css/properties/font-size.md.
Lynx
  • 简体中文
  • font-size

    介绍

    font-size 属性指定字体的大小。因为该属性的值会被用于计算 emrem 的长度单位。定义该值可能会改变其他元件的大小。

    使用示例

    语法

    /* <length> */
    font-size: 12px;
    font-size: 0.8em;
    
    /* <percentage> */
    font-size: 80%;

    取值

    • <length>
      只能是正数。当单位为 emrem 时,大小相对与父元件或跟元件的字体大小。

    • <percentage>
      相对父元件字体大小。

    形式定义

    初始值14px
    适用元素text
    是否支持继承yes
    是否支持动画no

    形式语法

    font-size = <length> | <percentage>

    与 Web 的区别

    • 不支持 xx-smallx-small 等指定绝对字体大小的关键字。

    • 默认值是 14px,web 中默认值是 medium 指定的绝对大小。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。