Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control Drawing Layer Order of Properties #11671

Open
Karric opened this issue Feb 7, 2025 · 0 comments
Open

Control Drawing Layer Order of Properties #11671

Karric opened this issue Feb 7, 2025 · 0 comments

Comments

@Karric
Copy link

Karric commented Feb 7, 2025

Problem:
• Some properties, like border/background/box-shadow, are always 'behind' any children.
• Consider an overflow container, you may want a gradient at the top/bottom to create a faded edge effect. Although a mask can be used, sometimes a subtractive effect is undesired, an additive effect is wanted.

Proposal:
• A new property property-draw-order, with syntax similar to transition/animation. See example below.

Example:

box {
	overflow: scroll;
	background-image: linear-gradient(white,transparent);
	border: 2px solid gray;
	box-shadow: 0px 0px 10px 0px white;
	outline: 2px solid green;
	property-draw-order: outline 1, border background-image 2;
}

Before:
- border/background are drawn over by children.

After:
- border/background is drawn in front of children.

Implementation Notes:
• The number after the property is the layer stack order number, where the largest number represents the last/top-most layer.
• Multiple properties can be specified at once for a given number, as a way of sub-ordering ties. Otherwise, while reading left-to-right, add an imaginary increasing decimal to the order number when encountering the same order number.
• It may be extreme to describe this as paint-level z-indexing, but that is the spirit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant