Instead of using JS you could add a data
attribute on the div
element with the value you also print inside, e.g.
<div data-letter="<bean:write ... />"> <!-- or whatever it takes to print the same value here -->
<bean:write name="messageFormBean" property="messageVO.messageFormat"/>
</div>
and use all the necessary CSS attribute selectors to set all the properties you need
[data-letter="A"] { margin: -2.4% 0 0 -14% }
[data-letter="B"] { margin: -2.4% 0 0 -3% }
...
[data-letter="Z"] { margin: ... }
Benefit of this approach: no unnecessary use of JS, no CSS-in-JS and no inline style.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…