There is no direct way to do this. As said, you cannot do any calculations in CSS files. Therefore, we continue to say that CSS not complete, we must make a float to display our pages correctly, which is pointless when you think about it.
As you created css, you can add 4pt yourself. If you don't want hard code, you can use CSS frameworks or other languages that create CSS output. The framework is fine, but I do not recommend using other languages that generate CSS output for you. It's fun, but you will not learn the language, and since CSS is a difficult language to understand, you will be stuck if you have any errors, errors on your page.
So, for your question, you can use javascript to getComputedStyle and add 4pt and set the element style.
This is javascript that gets the style:
function getStyle(el,styleProp) { var x = document.getElementById(el); if (x.currentStyle) var y = x.currentStyle[styleProp]; else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); return y; }
Using:
var height = parseInt(getStyle("elementId", "line-height")); var earlycss = document.getElementById("elementId").style.cssText document.getElementById("elementId").style.cssText = earlycss + "\nline-height: " + (height + 4) + "px;";
source share