Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to specify image size in pixels

Tags:

html

Quick question about specifying the size of images in pixels:

<img src="/logo.jpg" alt="logo" width="200px" height="120px" />

or

<img src="/logo.jpg" alt="logo" width="200" height="120" />

I've been always putting in the px but recently noticed that very few people do this. Am I better off leaving that out? Does it matter one way or the other?

like image 921
Andy Avatar asked Aug 24 '11 14:08

Andy


1 Answers

Use css to consider the the size of the image:

CSS:

.logo {
width: 200px;
height: 120px;
}

HTML:

<img src="/logo.jpg" alt="logo" class="logo" />
like image 62
Akos Avatar answered Nov 10 '22 17:11

Akos