Skip to content

I want to pin evaluation of a CSS custom property to the element it's defined on #236

Open
@aarongustafson

Description

@aarongustafson

title: I want to pin evaluation of a CSS custom property to the element it's defined on
date: 2020-12-04T19:35:43.617Z
submitter: PRIVATE
number: 5fca8f8fcb050301104f7a6a
tags: [ ]
discussion: https://github.com/WebWeWant/webwewant.fyi/discussions/
status: [ discussing || in-progress || complete ]
related:

  • title:
    url:
    type: [ article || explainer || draft || spec || note || discussion ]

As an example, if I need to know the width of a container element to calculate the width of a deeply nested element:

.container {
--container-width: 100%;
}

.container__deeply-nested-element {
// what I need is the actual container width to be able to correctly
// calculate the desired width of the nested element...
// but 100% is evaluated here to the element's parent :(
width: calc(var(--container-width, 0) / 3);
}


If posted, this will appear at https://webwewant.fyi/wants/5fca8f8fcb050301104f7a6a/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CSSno-activitywantIncoming requests from the community

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions