Images: Width & Height

You can use the CSS style attribute to specify the width and height of an image. The values are specified in pixels (use px after the value):

<img src="html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;">

Alternatively, you can use HTML width and height attributes. The values are specified in pixels by default:

<img src="html5.gif" alt="HTML5 Icon" width="128" height="128">

Images are displayed the exact same way with both methods, but the CSS style is recommended, and the reason why is demonstrated on the next page.

Back button Table of Contents Next button