We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

« SVG Attribute reference home

The font-size attribute refers to the size of the font from baseline to baseline when multiple lines of text are set solid in a multiline layout environment. For SVG, if a <length> is provided without a unit identifier (e.g., an unqualified number such as 128), the browser processes the <length> as a height value in the current user coordinate system.

If a <length> is provided with one of the unit identifiers (e.g., 12pt or 10%), then the browser converts the <length> into a corresponding value in the current user coordinate system

As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see css font-size for further information.

Usage context

Categories Presentation attribute
Value <absolute-size> | <relative-size> | <length> | <percentage> | inherit
Initial value medium
Animatable Yes
Normative document SVG 1.1 (2nd Edition)


font size with pixel


h1 {font-size:30px;}
h2 {font-size:20px;}
p {font-size:15px;}



font size with Em


h1 {font-size:2.9em;}
h2 {font-size:1.9em;}
p {font-size:0.9em;} 




The following elements can use the font-size attribute

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support ? ? ? ? ? ?
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support ? ? ? ? ? ? ?

See also


此頁面的貢獻者: connorshea, thnidu, dhaval, Jeremie
最近更新: connorshea,