HTML: Controlling image size

This entry is part 32 of 34 in the series HTML

Image size is expressed in pixels.  If you want, you can specify only the width, the height will be resized proportionally.  Or you can specify the height.

The original image size below is 800 x 600.  We specify the height to 200px.

<!DOCTYPE html>
<html>
<head lang='en'>     
    <meta charset='UTF-8'>
    <title>Codecrawl.com-Image</title>
</head>
<body>

<img src='//codecrawl.com/code/images/ushuaia.jpg' height='200'>

</body>
</html>

We can also provide a fixed size to the image as in:

 

 

Series Navigation<< HTML: Clearing a graphic
HTML: Image margin >>