Mohamed Hussain Mohamed Hussain - 1 year ago 195
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.

Answer Source

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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download