Skip to content

Improve documentation of font weight for inherit custom value #2304

@AmProsius

Description

@AmProsius

Use case: I have a horizontal table and want <th>'s font weight to be inherited from the parent.

<table>
  <tr>
    <th>Name</th>
    <td>James Bond</td>
  </tr>
</table>

My first instinct was to add font-inherit to the <th>. But then I realized that inherit is not a default value for font-weight, so I tried font-[inherit]. As font-* is ambiguous, this renders font-family: inherit;. Only after a quick search I found a comment that suggests using font-[weight:inherit] which actually worked. As weight is not a default CSS data type, I didn't intuitively try that.

It would be great if the documentation shows the font weight's "data type". I think font-[weight:inherit] is no uncommon use case. Maybe something similar to how the documentation handles font-family.

The same is true for text-[inherit] which renders color: inherit;. If I wanted to set font-size: inherit;, I would have to use text-[length:inherit] which I found here.

If you agree, I would happily create a PR to add the "data type" weight to the Using a custom value section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions