The font-size attribute refers to the size of the font from baseline when multiple lines of text are set solid in a multiline layout environment.
Syntax:
font-size="size"
Attribute Values:
- length: Length at which we want to set the size.
- percentage: Percentage at which we want to set the size.
We will use the font size attribute for setting the size of font.
Example 1
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 600 100"
< text x = "10" y = "50"
font-size = "smaller" >
smaller
</ text >
< text x = "10" y = "30"
font-size = "2em" >
larger
</ text >
</ svg >
</ body >
</ html >
|
Output:
Example 2:
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 600 100"
< text x = "10" y = "50"
font-size = "60%" >
smaller
</ text >
< text x = "10" y = "30"
font-size = "240%" >
larger
</ text >
</ svg >
</ body >
</ html >
|
Output:
Last Updated :
31 Mar, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...