lea.verou.me/2021/06/inherit-ancestor-font-size-for-fun-and-profit
Preview meta tags from the lea.verou.me website.
Linked Hostnames
17- 13 links tolea.verou.me
- 6 links tocodepen.io
- 4 links togithub.com
- 2 links todrafts.csswg.org
- 2 links tohtml.spec.whatwg.org
- 1 link to11ty.dev
- 1 link tobsky.app
- 1 link tocaniuse.com
Search Engine Appearance
Inherit ancestor font-size, for fun and profit • Lea Verou
If you’ve been writing CSS for any length of time, you’re probably familiar with the em unit, and possibly the other type-relative units. We are going to refer to em for the rest of this post, but anything described works for all type-relative units. As you well know, em resolves to the current font size on all properties except font-size, where it resolves to the parent font size. It can be quite useful for making scalable components that adapt to their context size. However, I have often come across cases where you actually need to “circumvent” one level of this. Either you need to set font-size to the grandparent font size instead of the parent one, or you need to set other properties to the parent font size, not the current one. If you’re already familiar with the problem and just want the solution, skip ahead. The next few paragraphs are for those thinking “but when would you ever need this?” Sometimes, there are workarounds, and it’s just a matter of keeping DRY. For example, take a look at this speech bubble:
Bing
Inherit ancestor font-size, for fun and profit • Lea Verou
If you’ve been writing CSS for any length of time, you’re probably familiar with the em unit, and possibly the other type-relative units. We are going to refer to em for the rest of this post, but anything described works for all type-relative units. As you well know, em resolves to the current font size on all properties except font-size, where it resolves to the parent font size. It can be quite useful for making scalable components that adapt to their context size. However, I have often come across cases where you actually need to “circumvent” one level of this. Either you need to set font-size to the grandparent font size instead of the parent one, or you need to set other properties to the parent font size, not the current one. If you’re already familiar with the problem and just want the solution, skip ahead. The next few paragraphs are for those thinking “but when would you ever need this?” Sometimes, there are workarounds, and it’s just a matter of keeping DRY. For example, take a look at this speech bubble:
DuckDuckGo
Inherit ancestor font-size, for fun and profit • Lea Verou
If you’ve been writing CSS for any length of time, you’re probably familiar with the em unit, and possibly the other type-relative units. We are going to refer to em for the rest of this post, but anything described works for all type-relative units. As you well know, em resolves to the current font size on all properties except font-size, where it resolves to the parent font size. It can be quite useful for making scalable components that adapt to their context size. However, I have often come across cases where you actually need to “circumvent” one level of this. Either you need to set font-size to the grandparent font size instead of the parent one, or you need to set other properties to the parent font size, not the current one. If you’re already familiar with the problem and just want the solution, skip ahead. The next few paragraphs are for those thinking “but when would you ever need this?” Sometimes, there are workarounds, and it’s just a matter of keeping DRY. For example, take a look at this speech bubble:
General Meta Tags
11- titleInherit ancestor font-size, for fun and profit • Lea Verou
- charsetUTF-8
- viewportwidth=device-width, initial-scale=1
- authorLea Verou
- article:authorLea Verou
Open Graph Meta Tags
3- og:titleInherit ancestor font-size, for fun and profit • Lea Verou
- og:typearticle
- og:descriptionIf you’ve been writing CSS for any length of time, you’re probably familiar with the em unit, and possibly the other type-relative units. We are going to refer to em for the rest of this post, but anything described works for all type-relative units. As you well know, em resolves to the current font size on all properties except font-size, where it resolves to the parent font size. It can be quite useful for making scalable components that adapt to their context size. However, I have often come across cases where you actually need to “circumvent” one level of this. Either you need to set font-size to the grandparent font size instead of the parent one, or you need to set other properties to the parent font size, not the current one. If you’re already familiar with the problem and just want the solution, skip ahead. The next few paragraphs are for those thinking “but when would you ever need this?” Sometimes, there are workarounds, and it’s just a matter of keeping DRY. For example, take a look at this speech bubble:
Twitter Meta Tags
2- twitter:titleInherit ancestor font-size, for fun and profit • Lea Verou
- twitter:descriptionIf you’ve been writing CSS for any length of time, you’re probably familiar with the em unit, and possibly the other type-relative units. We are going to refer to em for the rest of this post, but anything described works for all type-relative units. As you well know, em resolves to the current font size on all properties except font-size, where it resolves to the parent font size. It can be quite useful for making scalable components that adapt to their context size. However, I have often come across cases where you actually need to “circumvent” one level of this. Either you need to set font-size to the grandparent font size instead of the parent one, or you need to set other properties to the parent font size, not the current one. If you’re already familiar with the problem and just want the solution, skip ahead. The next few paragraphs are for those thinking “but when would you ever need this?” Sometimes, there are workarounds, and it’s just a matter of keeping DRY. For example, take a look at this speech bubble:
Link Tags
5- alternate../../../../feed.xml
- dns-prefetchhttps://kit.fontawesome.com
- shortcut icon../../../../mark.svg
- stylesheet../../../../assets/style.css
- stylesheethttps://kit.fontawesome.com/040e756b7e.css
Links
39- http://twitter.com/leaverou
- https://11ty.dev
- https://bsky.app/profile/lea.verou.me
- https://caniuse.com/mdn-css_at-rules_property
- https://codepen.io/leaverou/pen/ExWqyzQ