Consider the following scenario with two div elements:
.example{
width: 200px;
height: 200px;
z-index: 4;
}
<div id="first" style="height:100px;width:200px;z-index:5;">Hardcoded</div>
<div id="second" class="example" >Css</div>
How can I determine using jQuery or JavaScript if, for instance, the height of a div is defined by the style attribute? Or how can I identify if the height is set, but not through a CSS class?
It appears there may be some confusion about my query. Although one answer came close but was later removed: The question isn't about "what value is assigned to the height". or "whether a specific class is applied" Given a particular style property such as 'height', I am interested in finding out two things:
- Has the height been set in any way other than the default browser settings, like via a CSS class or inline style? (I believe I can figure this out on my own)
- If so, has the height been defined through the style="...." attribute or via a class=""? The specific class used doesn't matter.