DEV Community

FSCSS tutorials for FSCSS tutorials

Posted on • Edited on • Originally published at ln.run

Assigning one value to multiple properties FSCSS

Here is some FSCSS4 method that can assign one value to multiple properties in CSS.
Example:
The %2 method in FSCSS (Figured Shorthand Cascading Style Sheet) is used to assign the same value to two properties in a concise way. Instead of writing each property separately, you can group them together and provide the value once.

  • mx() or $m() $M(up to 6 properties separated with comma ':value;') -mxs() or $p() $P(up to 6 properties separated with comma 'value auto enclose with colon and semicolon') Example : $p(max-height, max-width,'500px')
  • %I( up to 10 properties separated with comma [:value;]) Example 1: %i(width, height[:480px;]) Example 2: %i(transform: rotateY, transform: skewX[(90deg);])
  • %6(up to 6 properties[:value;])
  • %5(up to 5 properties[:value;])
  • %4(up to 4 properties[:value;])
  • %3(up to 3 properties[:value;])
  • %2(up to 2 properties[:value;])
  • %1(1 property[:value;])

RGB color with %3()
rgb(%3([100,])1)
The method shared the value in 3 places.
CSS: rgb(100,100,100,1)
More examples:
FSCSS: rgb(%2(200[,200]))
CSS: rgb(200,200,200)

HSL color with %2()
hsl(200%2([,50%]))
The method shared the value in 2 places.
CSS: hsl(200,50%,50%)
More examples:
FSCSS: hsla(500%2([,25%]))
CSS : hsla(500,25%,25%)

Hexadecimal color with FSCSS

FSCSS: #%6([0])
CSS: #000000
FSCSS: #%3(F,D,8[0])
CSS: #F0D080

With 200px height 200px in FSCSS
FSCSS: %2(WIDTH, HEIGHT[:200PX;])
The %2 means that the parameter will not contain more than 2 properties,
The WIDTH is the first property and the HEIGHT is the second property,
And the value for both of them is enclosed in the square brackets.

CSS: width: 200px; height: 200px;

<script src='https://cdn.jsdelivr.net/gh/Figsh/FSCSS@4.0.1/fscss_exec.js' async=""></script>
<style>
//test FSCSS4
</style>
Enter fullscreen mode Exit fullscreen mode


AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more