0

I have the following operation sass make a loop in one of their attributes and want to be a percentage width% but the output is very different

//h1,h2,h3,h4,h5,h6
$i: 6;
@while $i > 0 {
    h#{$i} {
        position: relative;
        padding-left: 1px + $i;


padding-right: 1px + $i;
    &::before {
        background: $color-ternary;
        content: "";
        display: block;
        height: 1px;
        position: absolute;
        width: #{$i}'%';
        bottom: 0;
        left: $i px;
    }
}
$i: $i - 1;

} the output

  width: 1"%";

the expectatives

  width: 1%;
  width: 2%;
  width: 3%;

etc...

Cazs
  • 21
  • 7
  • that does not solve my problem, only serves to px units if I apply the same logic returns the following. ouput width: 10%; its not correct. – Cazs May 19 '15 at 20:49
  • You're doing something wrong then. The only way Sass would generate 10% is if your expression is `10 * 1%`. – cimmanon May 20 '15 at 01:10

0 Answers0