Multi-Line Properties in Stylus for box-shadow
Asked Answered
S

2

7

How can I rewrite the following line into a multi-line form in stylus?

div
  box-shadow 0 0 0 black, 1 0 0, black, 0 0 1, black

Using a much larger list of properties for box-shadow will make my editor explode. I want sth like this, but Stylus syntax will not allow it:

div
  box-shadow
    0 0 0 black,
    1 0 0 black,
    0 0 1 black

Also omitting the commas is not working. This is frustrating...

Saladin answered 2/3, 2014 at 0:40 Comment(1)
btw: you can find the stylus team discussing the issue here.Downcomer
L
6

I believe i have seen the coding set up like this:

div
  box-shadow:
    0 0 0 black,
    1 0 0 black,
    0 0 1 black

or try this if the one above does not work

div
  box-shadow: 0 0 0 black,
              1 0 0 black,
              0 0 1 black

I Hope This Helps You.


Also works in the context of media queries. (real world example for retina-enabled sprites). Note the (somewhat odd-looking) indentation of the second background-image.

.sprite
  background-image url('/assets/static/sprite.png')
  background-repeat no-repeat
  background-size 960px 480px;

  @media only screen and (-webkit-min-device-pixel-ratio 1.3),
    only screen and (-o-min-device-pixel-ratio 13/10),
    only screen and (min--moz-device-pixel-ratio 1.3),
    only screen and (min-device-pixel-ratio 1.3),
    only screen and (min-resolution 120dpi)
    background-image url('/assets/static/sprite_x2.png')
Ladawnladd answered 2/3, 2014 at 1:45 Comment(1)
Yes! I didnt think I'd ever have to use colons in Stylus, but so be it.Saladin
C
2

I wrote like this.

div
  box-shadow \
    0 0 0 black \
    1 0 0 black \
    0 0 1 black
Conyers answered 30/1, 2018 at 6:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.