CSS Dimension Code Tutorials

CSS dimension properties allow you to control the height and width of an HTML element. It also allows you to control the spacing between 2 lines.

How to set the height of an image using a pixel value

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<title>this is the title of the web page</title>

<style type="text/css">
img.normal {height: auto;}
img.big { height: 60px;}
img.small { height: 10px;}

<img class="normal" src="image.jpg" width="63" height="30" />
<img class="big" src="image.jpg" width="63" height="30" />
<img class="small" src="image.jpg" width="63" height="30" />

The above XHTML and CSS code produces the images below:

css image

css image

css image

You can use the image code below to practice using the dimension property.

<img src="csshtmltutorial-i2.jpg" border="0" width="63" height="30" alt="css image" />