csswg-drafts icon indicating copy to clipboard operation
csswg-drafts copied to clipboard

[css-values] Request for New CSS Unit Proposal (pem Unit)

Open softwaredevomar opened this issue 1 year ago • 1 comments

Dear W3C Submissions Team, I, the undersigned, hereby submit the attached proposal for the introduction of a new CSS unit, pem, which stands for “parent element”. This proposal aims to enhance clarity, accessibility, and understanding in CSS by explicitly indicating that the size is relative to the parent element’s font size, similar to how rem indicates a relationship to the root element.

Please find the detailed submission document attached to this issue description. I believe this addition will significantly benefit the web development community by making CSS more intuitive, especially for new developers.

I look forward to your feedback and are available for any further discussions or clarifications needed. Submitted Materials.docx

softwaredevomar avatar Oct 18 '24 21:10 softwaredevomar

You basically want inherit(font-size) from #2864 For now we restricted it to custom properties, but it should still allow something like

@property --em {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --pem {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
* {
  --em: 1em;
  --pem: inherit(--em);
}
#foo {
  padding: 2--pem;
}

Loirooriol avatar Oct 19 '24 12:10 Loirooriol

For the benefit of misdirected searchers, I note that the unit name pem is being adopted in #10674 instead as "preferred em", i.e. relative to the user's minimum font size preference.

cvrebert avatar May 23 '25 00:05 cvrebert