img width Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:img

Introduction

The width attribute specifies the width of an image, in pixels.

Attribute Values

Value Description
pixels The width in pixels (e.g. width="100")

An image with a height and a width of 42 pixels:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<img src="https://www.java2s.com/style/demo/Opera.png" alt="Smiley face" width="42" height="42">

</body><!-- w ww.  j a  va 2 s  .c o  m-->
</html>

Related Tutorials