Mohamed Hussain Mohamed Hussain - 7 months ago 101
CSS Question

Concatenate String for class name in LESS

I am converting LESS to CSS, there I want to run the LESS function below:

.myPL( @val ) {
.pL @val{

Function Call:

.myPL( 20px );

Expected result:


But actual result is Syntax Error.

Please help me to concatenate the strings in class name in LESS.


What you are looking for is called selector interpolation ... you can find it here:

Your mixin would need to look like this for it to work:

.myPL( @val ) {
  .pL@{val} {
    padding-left: @val;