I would like to specify the horizontal padding of a styled element as variable 'x' and the vertical padding as variable 'y'. Here's one way to achieve this:
var docex = document.getElementById.style;
docex.paddingTop = y;
docex.paddingBottom = y;
docex.paddingLeft = x;
docex.paddingRight = x;
Is there a more concise method to accomplish this, perhaps something like:
var docex = document.getElementById.style;
docex.paddingTop = docex.paddingBottom = y;
docex.paddingLeft = docex.paddingRight = x;
However, it seems that the above approach might not work and could lead to declaring a global variable, according to another question I found on this site. So, what is the most efficient and minimal way to implement a similar idea using vanilla JavaScript?
Thank you in advance!