vagrant_tiger
vagrant_tiger

Reputation: 7

Img height not working

In CSS file, it writes as blow:

img {
    max-width: 100%;
    height: auto;
}

In HTML, I write this:

<img height="1" width="340">

The result is width:340,height:341 but I want the height=1.

The css file can not be modified and I must use it.
There has a lot of <img> tags and the height is different.

How to make the height: auto; invalid?

Upvotes: 1

Views: 456

Answers (2)

Felix A J
Felix A J

Reputation: 6470

img, video {    max-width:100%; height: auto;}
img{
max-height: 1px;
display: block;
}
<img height="1" width="340" src="http://lorempixel.com/400/200/nature/">

Upvotes: 1

ItzMe_Ezhil
ItzMe_Ezhil

Reputation: 1406

you can write inline css like.

     <img style ="height:1px; width:340px;" >

Because inline CSS has more power than external or internal css

Upvotes: 0

Related Questions