For the specified Javascript width, you can try the following:
document.getElementById("myDivElement").style.width
If the above value returns an empty string, it means that Javascript has not been specified.
For the rules defined using CSS, find the name of the class, and then the rules specified for that class:
var className = document.getElementById("myDivElement").className;
var cssWidth = getWidthFromClassname (className);
Now you need to define getWidthFromClassname :
function getWidthFromClassname(className) { var reqWidth; var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules for(var x=0;x<classes.length;x++) { if(classes[x].selectorText==className) { reqWidth = classes[x].style.getPropertyValue("width"); break; } } return reqWidth; }
source share