Inherit font size
![inherit font size inherit font size](https://ae01.alicdn.com/kf/HTB1mNZEJpXXXXaHaXXXq6xXFXXXy/221871946/HTB1mNZEJpXXXXaHaXXXq6xXFXXXy.jpg)
(Or create a class style and apply it to the tag.) In the style, specify the font you wish to use, and all of the tags on the page inherit the font: body. Most developers use a combination of different font sizes to style a web page.
![inherit font size inherit font size](https://dataproblemandsolutions.files.wordpress.com/2017/04/css-file.png)
The property accepts values in px, em, rem, vw, vh, and using keywords. The font-size property can be applied to any class, ID, or element that includes text content. Instead of creating styles for each tag, simply create a tag style for the tag. The CSS font-size property sets the font size of any text element on your page or website. Say you want all the text on a page to use the same font. You can use inheritance to your advantage to streamline your style sheets. The same holds true for ID styles, descendant selectors, and the other types of styles discussed in Chapter 3. It works with any type of style, so when you apply a class style (see Class Selectors: Pinpoint Control) to a tag, any tags inside that tag inherit properties from the styled tag. Once I set font to the form, font style for the columns that created by the designer will change back to 10pt at run time. Inheritance doesn’t just apply to tag styles. You’d then have to create another style to format the tag to match the appearance of the tag. If you created a style that made the paragraph text white and 32 pixels tall, using the Varela Round font, it would be weird if all the text inside the, and tags reverted to its regular, “browser boring” style (see Figure 4-1). Imagine if no properties were passed onto nested tags and you had a paragraph that contained other tags like a tag, an tag to emphasize text and an tag to add a link. Descendants (think kids and grandchildren) inherit properties from ancestors (think parents and grandparents).Īlthough this may sound confusing, inheritance is a really big timesaver. So a tag inside the tag is a descendant of the, while the tag is an ancestor of the tag. HTML (default font size) 1.2, medium 12pt, small 10tp, x-small 8pt, large 14pt, x-large 16pt. As discussed in Chapter 3, any tag inside of another tag is a descendant of that tag.