Yes, it is possible to apply the font shorthand to use the identical font as the h1 tag without reiterating the font size. Here is an example:
h1 {
font-family: Arial;
font-size: 36px;
font-weight: bold;
}
p {
font: bold Arial;
}
In the above code, the font
shorthand for the p
tag uses the same font family and weight as the h1
tag (Arial and bold), but does not include the font-size property. Therefore, the font size for the p
tag will inherit the font-size from its parent element or default to the browser’s default size.
Asked: 2021-08-04 11:00:00 +0000
Seen: 11 times
Last updated: Jun 12 '21