Create dynamic css class ex .font-size { font-size: size}

Is it possible to create dynamic css font classes such as in the title where size in .font-size become the parameter used as size :

.font-size { 
     font-size: size px;
}

and you could add

<p class="font-14"> 

which would call

.font-14 {
   font-size: 14px;
}

Answers


If you want to dynamicaly generate the CSS font declarations with the corresponding classes, you should look into CSS Preprocessors like SASS or LESS.

Here is an example with SCSS :

@for $i from 14 through 30 {
  .font-#{$i} {
    font-size: $i + px; 
  }
}

This will output :

.font-14 { font-size: 14px; }
.font-15 { font-size: 15px; }
.font-16 { font-size: 16px; }
...
.font-30 { font-size: 30px; }

Need Your Help

Using Qt Creator to develop an Apache2 module

qt apache2 qt-creator

I'm developing an Apache2 module as a subproject of a larger project. The source file is (for example) module_example.c. Apache2 modules are compiled with apxs2, thus:

Using Emacs for big big projects

search emacs editor project

Maybe is a often repeated question here, but i can't find anything similar with the search.