syntax - Why isn't this LESS mixin working? -
.v-centered (@height,@width) { width: @width; height: @height; position: absolute; top: 50%; left: 50%; margin: (@height / 2)px 0 0 (@width / 2)px; } i trying make less mixin vertically centering things (the non-line-height way) -- , less mixin isn't working. have feeling has margin: (@height / 2)px 0 0 (@width / 2)px; line can't see i'm going wrong in syntax. appreciated.
it depends on how you're using it. right code assumes width , height passed in without units, width , height properties don't append unit margin property.
also, correctly center want negate margins.
.v-centered (@height, @width) { width: @width; height: @height; position: absolute; top: 50%; left: 50%; margin: -(@height / 2) 0 0 -(@width / 2); }
Comments
Post a Comment