[csswg-drafts] [css-box] Suggestion: Add "of <property>" syntax for percentage values of padding and margin properties (#6814)

RolandHeinze has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-box] Suggestion: Add "of <property>" syntax for percentage values of padding and margin properties ==
The [CSS Box Model Level 3](https://drafts.csswg.org/css-box-3) and [CSS Box Model Level 4](https://drafts.csswg.org/css-box-4) Specifications define the properties `margin-top`, `margin-right`, `margin-bottom`, `margin-left`, `margin`, `padding-top`, `padding-right`, `padding-bottom`, `padding-left`, and `padding`. They are all allowed to have percentage values. Currently, the percentage value always refers to the `width` of the containing block. This can be an unwanted restriction. In particular, `margin-top`, `margin-bottom`, `padding-top`, and `padding-bottom` represent vertical lengths, and the percentage values refer to horizontal lenghts. This can be irritating.

I want to suggest a more universal approach:
Please add the syntax `of <property>` for percentage values of all the mentioned properties. `<property>` can be any property name of the containing block which has a length value. It would bring much greater flexibility in relating percentages to property values for the end user of CSS. E.g. You can write
```
margin-top: 10% of height;
padding-left: 50% of padding-left;
padding-bottom: 30% of border-bottom-width;
```
I propose to offer similar extensions for other properties which allow percentage values such as `font-size` as end users also want to relate the font size to the height or width of the parent element which is currently not possible. Of course, that it out of the scope of the CSS Box Model Specification.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6814 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 12 November 2021 22:09:30 UTC