Most of the attributes used to explain physical properties or element's placement (position) have been deprecated and replaced with style sheets. Those that remained in use in HTML 4.01 are mostly element specific and are added to execute a special task.

Related elements:

width attribute:

IMG, OBJECT, TABLE, COLGROUP, COL, IFRAME

height attribute:

IMG, OBJECT, IFRAME

ismap attribute:

IMG, INPUT

shape attribute:

A, AREA

coords attribute:

A, AREA

rows attribute:

TEXTAREA, FRAMESET

cols attribute:

TEXTAREA, FRAMESET

Attribute characteristics and purpose:

width attribute:

  • <img />, <object> - overrides natural width of an image; good practice is not to increase the image size as that leads to image stretching and the other good practice is to put the width in pixels that matches the natural width of the image because that will save some time and resources that browser needs for rendering it; if put in % instead of pixels then the width is calculated of the horizontal space available
  • <table> - determines the width of the entire table; if put in % instead of pixels then the width is calculated of the horizontal space available; if the width attribute is missing an user agent calculates the width
  • <colgroup>, <col /> - determines the width of a column in a table; in these elements attribute width is a data type multi-length and it can have a special form (beside pixels, % and relative values) of "0*" which means that the width will match the column's content; the width attribute set inside <col /> element overrides the same attribute inside <colgroup> element
  • <iframe> - sets the width of an inline frame

height attribute:

  • <img />, <object> - overrides natural height of an image; good practice is not to increase the image size as that leads to image stretching and the other good practice is to put the height in pixels that matches the natural height of the image because that will save some time and resources that browser needs for rendering it; if put in % instead of pixels then the height is calculated of the vertical space available
  • <iframe> - sets the height of an inline frame

ismap attribute:

  • used in a server side image map; <img /> element has to be set inside an <a> element that contains a link pointing to the image location on a server while <input /> element naturally has to be defined as type="image"; server side image maps are used for complex image map applications; when a user interacts with such a map the screen coordinates are sent to the server with the map position
  • it is a Boolean type of attribute and it must be added as ismap="ismap"

shape attribute:

  • specifies the shape of a region (area) of an image map
  • possible values are default (entire region), rect (rectangular region), circle (circular region), poly (polygonal region)

coords attribute:

  • specifies the position and shape of an area on the image map
  • values depend on the shape defined with shape element; they are: left-x / top-y / right-x / bottom-y (rect), center-x / center-y / radius (circle), x1 / y1 / x2 / y2 / ... / xN / yN (poly)
  • in case of polygonal region the first pair x1 / y1 should match the last pair in order to close the area up

rows attribute:

  • <textarea> - specifies the number of visible text lines; if the number of visible lines is exceeded usually browsers render scrolling bars
  • >frameset> - specifies the layout of horizontal frames; values are comma separated list of %, pixels or relative lengths; default is 100% which means one row; a value can be replaced with * sign which refers to "everything that is left"

cols attribute:

  • <textarea> - specifies the visible width in average character widths; if the number of visible lines is exceeded usually browsers render scrolling bars; browsers might apply text wrap in order to show entire line(s) without scrolling bars
  • <frameset> - specifies the layout of vertical frames; values are comma separated list of %, pixels or relative lengths; default is 100% which means one column; a value can be replaced with * sign which refers to "everything that is left"

Example

HTML physical attributes:

 

›› go to examples ››