Dana Louise Bersamin Dana Louise Bersamin - 6 months ago 88
Less Question

How to convert margin: 0 auto to .rem(margin:..)?

This is a sample code how we use rem in our website:

.width(1200px);
.rem(padding, 100px);
.rem2(padding, 100px, 50px);
.rem3(padding, 100px, 50px, 0);


So basically, .rem() automatically converts px units to rem so that it will adjust to the dimension of the root (html) element.

However, what if I want to convert
margin: 0 auto;
to
.rem()
. How will I do the auto margin using this function?

Answer Source

You can't.

auto is (in very simple terms) whatever is left over.

That varies depending on the size of the browser window.

There's no way to calcaulte it at the time LESS runs.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download