# Reading Detailed CSS properties with Javascript

**URL:** <https://forum.kirupa.com/t/reading-detailed-css-properties-with-javascript/258301>\
**Category:** web dev\
**Created:** [April 22, 2008, 8:32pm UTC](https://forum.kirupa.com/t/reading-detailed-css-properties-with-javascript/258301 "2008-04-22T20:32:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevisazombie](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kevisazombie/32/3903_2.png) [@kevisazombie](https://forum.kirupa.com/u/kevisazombie)\
**Post date:** [April 22, 2008, 8:32pm UTC](https://forum.kirupa.com/t/reading-detailed-css-properties-with-javascript/258301/1 "2008-04-22T20:32:03Z")

</div>

Hi all,

I am trying to get the detailed CSS properties of an element. I am looking specifically at the width and height, to see if they are set to auto, inherit, or normal. I have a bit of javascript so far:

```auto

if(element.currentStyle){ 
  var y = element.currentStyle.width; 
  alert("ie 
"+y); 
}else if(window.getComputedStyle){ 
  var y=document.defaultView.getComputedStyle(element,null).getPropertyValue("width");
  alert("moz 
"+y);  
} 
 

```

the IE code works fine and will report back if a element is set to auto. The Mozilla code comes back with a measurement of the objects width in pixels similar to an offsetHeight. I’m hoping there is an alternative to .getComputedStyle or a different property value that will give me the information im looking for.
