[WEB4LIB] what is a replaced element?

Thomas Dowling tdowling at ohiolink.edu
Wed Jan 19 11:49:56 EST 2005


John Fitzgibbon wrote:
> Hi,
> 
> My understanding is that a replaced element is an empty element that
> occupies space like a button on a form or an image. It is also an inline
> element (an element that does not force the next element onto a new
> line).

A replaced element is one that, when the page is rendered, is replaced 
by material from another source.  Inline images are the most common 
example: a browser only uses the <img> element to pull the image file 
from elsewhere and insert it into the document.  Form inputs are 
replaced elements (they're replaced by input widgets provided by the OS 
or the browser), and <object> is a less common replaced element.  Not 
all replaced elements are inline.

> 
> Is this correct or is it just a coincidence that all the examples of
> replaced elements that I know about happen to be empty (no text between
> the start tag and end tag)?

Not all replaced elements are empty.

> 
> What is the significance of replaced elements? All other inline
> elements, eg a and em, occupy a space which is determined by the content
> (the text between the start tag and end tag) of the element.

That's why CSS often treats replaced elements separately from either 
block or inline elements.  Height and width properties are defined for 
<img> for example, but not for <span>.


-- 
Thomas Dowling
tdowling at ohiolink.edu







More information about the Web4lib mailing list