1

I cannot seem to find any documentation on the possibility (or if even possible) to do the following.

Below is the basic CSS/SASS namespaces declaration:

.example {
  border: {
    style: dashed;
    width: 30px;
    color: blue;
  }
}

Is it possible to still have this format, but chain the top, right, bottom, left declaration?

How I would imagine this being written:

.example {
  border: {
    top, right, bottom, left: {
      style: dashed;
      width: 30px;
      color: blue;
    }
  }
}

.example {
  border: {
    [top, right, bottom, left]: {
      style: dashed;
      width: 30px;
      color: blue;
    }
  }
}

2 Answers 2

2

It is possible (sorry for my previous wrong answer). That example seems to be working perfectly with all versions of SASS:

.example {
  border: {
    top: {
      style: dashed;
      width: 30px;
      color: blue;
    }
    left: {
      style: dashed;
      width: 30px;
      color: blue;
    }
  }
}

Check the example on SassMeister.

Sign up to request clarification or add additional context in comments.

4 Comments

I thought that might be the case, my examples were purely theory. Seems like something I should submit as a request on Github?
@shannon-young, check my last example. Sorry for my wrong previous response (I learned something new on SASS today :)). It's possible to nest properties but you need to separate theme like the example.
This is what I had initially, but if possible I was looking for a way to avoid the repetition. Thinking in D.R.Y terms.
I see. I'm pretty sure it's not possible for now. See if it exist on Github some ticket about that, I'm sure someone else wanted to do the same that you want.
0

You will need to add them one by one after border:{}, property like this:

.example{
      border:{
          style: dashed;
          width:10px;
         color: blue;
      }
     border-top:{
         width:3px;
       }
    border-left:{
      color:red;
     }
   border-right:{
      width:25px;
     }
     padding:70px;
  }

1 Comment

Thanks, it does not wholly answer my question though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.