Stefano Maglione
Stefano Maglione

Reputation: 4150

CSS height doesn't modify image

When I try to assign a height to my <div> that contains an <img>, it’s not modified, just moved.

.banner #dornierenvoj {
    left:-95px;
    bottom:-90px;
    height:-100px;!important
    position: absolute;
}
<div id="mapplane">
    <img src="templates/protostar/images/planeminiature.png" />

    <div id="dornierenvoj">
        <img src="templates/protostar/images/dornierenvoj.png" />
    </div>
</div>

Upvotes: 0

Views: 97

Answers (3)

alireza
alireza

Reputation: 507

First there is no negative height or width in css !

Second U can use this code to give that image height :

.banner #dornierenvoj img {
    height:100px;
}

Upvotes: 2

Dotan
Dotan

Reputation: 7622

That's because the css points to the div, not the image. you have 2 options:

1: add a class to the image

.bannerImage {height:30px;}
<img class="bannerImage" src="pic.png">
  1. define it in the css

    #dornierenvoj img {height:30px}
    <div id="dornierenvoj"><img src="pic.png"></div>
    

the code inside the {} will work on all images inside the div dornierenvoj.

Upvotes: 1

user2957312
user2957312

Reputation:

use this :

<img src=""templates/protostar/images/planeminiature.png" width="400" height="400">

THIS IS AN EXAMPLE of width and height

Upvotes: 1

Related Questions