Dynamische Klassennamen im WENIGER

Habe ich die folgenden etwas WENIGER code arbeiten

            @iterations: 940;
            @iterations: 940;
            @col:2.0833333333333333333333333333333%;
            //helper class, will never show up in resulting css
            //will be called as long the index is above 0
            .loopingClass (@index) when (@index > -20) {
                //create the actual css selector, example will result in
                //.myclass_30, .myclass_28, .... , .myclass_1
                (~".gs@{index}") {
                    //your resulting css
                    width: (@index/20+1)*@col;
                }
                //next iteration
                .loopingClass(@index - 60);
            }
            //end the loop when index is 0
            .loopingClass (-20) {}
            //"call" the loopingClass the first time with highest value
            .loopingClass (@iterations);

Gibt es unser grid-system, etwa so:

            .gs940 {
              width: 100%;
            }
            .gs880 {
              width: 93.75%;
            }
            .gs820 {
              width: 87.5%;
            }
            .gs760 {
              width: 81.25%;
            }
            .gs700 {
              width: 75%;
            }

etc etc etc

Nun, was ich tun möchte, ist etwas Mathematik, um die Namen der Klassen zu erzeugen, die folgenden Klassen

            .gs220-700
            .gs280-640
            .gs340-580
            .gs400-520
            .gs460-460
            .gs520-400
            .gs580-340
            .gs640-280
            .gs700-220

etc etc etc

grundsätzlich wäre dies
.(@index) - (920px minus @index)

Aber ich habe keine Ahnung, ob dies möglich ist.

InformationsquelleAutor R Reveley | 2012-06-05
Schreibe einen Kommentar