Question: I'm having some div boxes where there is an image inside. What I want it to do, is to add a class to the image if the image height is smaller than the div boxs height its inside.

But I have set the image to be a 100% width of the div box with css, so when I use jquery's .Height() on the image, it gives me the original size. Any suggestions?

```
<div class="boxe">
    <asp:Literal ID="imgProjekt1" runat="server" />
    <asp:Literal ID="litProjekt1" runat="server"/>
</div>

<div class="boxe forsideboxMiddle">
    <asp:Literal ID="imgProjekt2" runat="server" />
    <asp:Literal ID="litProjekt2" runat="server"/>
</div>

```

The literal with the ID imgProjekt1 and ImgProjekt2 makes a normal img tag from codebehind.

Answer: 
try 

```
var currentContentHeight = contentElement.offsetHeight;

```
You should use clientWidth & clientHeight.

```
var img = document.getElementById('imgProjekt1'); 
var width = img.clientWidth;
var height = img.clientHeight;

```

Edit:

```
$(window).load(function () { 
    var image = $('.boxe img');
    var box = $(".boxe");
    if (image[0].clientHeight > box[0].clientHeight) { 
        image.addClass('billedMiddle');
    }
});

```