Although it seems that you can do dynamic things if you use less.js in a browser, these styles are all compiled into CSS files and have fixed values โโby the time they are applied to your html. Therefore, you cannot change the values โโof smaller variables after loading the page .
If you need to dynamically change the width of a button based on several predefined sizes, I would say that you should add classes to your css (small, medium, large, etc.) and then dynamically add this class to your CSS using JQuery addClass .
If you need to set the width directly, I would use the jQuery css method.
If you intend to do a lot of this, you may need to use a data binding library that can bind a Javascript object to your html styles, like Knockout .
source share