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

[css-logical] Add some logical version for box-shadow and text-shadow #6338

Open
mrego opened this issue Jun 2, 2021 · 6 comments
Open

[css-logical] Add some logical version for box-shadow and text-shadow #6338

mrego opened this issue Jun 2, 2021 · 6 comments

Comments

@mrego
Copy link
Member

mrego commented Jun 2, 2021

Spec: https://drafts.csswg.org/css-logical/

It'd be nice to add the possibility to set the shadow offsets as inline and block so if we have a vertical writing mode it still looks similar.

Example:

  text-shadow: 10px 5px magenta;
  box-shadow: 20px 10px cyan;
  background: yellow;

On an element with horizontal writing mode the text shadow will be 10px on the right and 5px down, and the box shadow 20px on the right and 10px down.
And the same will happen on a vertical element.

Output of text-shadow and box-shadow from the previous example (text shadow will be 10px on the right and 5px down, and the box shadow 20px on the right and 10px down and the same on the vertical element)

If we could set those values in a logical form setting inline and block offset we could get the same effect in both horizontal and vertical writing modes. On the vertical element the text shadow will be 10px down and 5px to the left, and the box shadow 20px down and 10px left.

Proposed output if we have logical properties (the horizontal case is the same than before but the vertical one changes, now text shadow will be 10px down and 5px to the left, and the box shadow 20px down and 10px left

Note that there's a proposal to make box-shadow and text-shadow a shorthand, so this would be part of the box|text-shadow-offset.

@abhinaysindham45
Copy link

I don't know exactly what the issue is about
But i might think it can be solved using the filter effect instead of box shadow or text shadow
Try using filter : drop-shadow(10px 5px cyan)

@mrego
Copy link
Member Author

mrego commented Jul 12, 2021

The very same issue is also present with drop-shadow. The problem is that the offsets are physical (right and bottom), so when you have vertical writing mode, they still go to the right and to the bottom. The issue here is about having logical offsets, so when you're in RTL or a vertical writing mode they go in a different physical direction.

@jonjohnjohnson
Copy link

I have a feeling this could rely on what's resolved in #1282.

@abhinaysindham45
Copy link

something like
.box-shadow { 0 10px 10px black }

.vrm .box-shadow { 10px 0 10px black }

I was thinking of changing it with the direction attribute, but that doesn't help with vertical writing modes (I think?)....
Changing the shadow direction and using spread
I think it might help....

@ramiy
Copy link

ramiy commented Oct 17, 2023

@mrego I agree with you, this issue is becoming a major problem in my projects.

Currently, box-shadow and text-shadow properties use physical values not logical values. They should support different direction and writing-mode values, to support LTR & RTL writing-direction, in addition to vertical & horizontal writing-modes.

In the illustration above, you display only different writing modes. But when you use direction: rtl; the shadow doesn't switch to the other side. It should be addressed too.

@SebastianZ
Copy link
Contributor

As mentioned in an earlier comment, #1282 is trying to find a general solution for the physical/logical values issue. The solution there will apply to box-shadow and text-shadow as well.

@frivoal Just adding you to the discussion to add those two properties when enumerating the ones affected by this issue.

Sebastian

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

No branches or pull requests

5 participants