The Wayback Machine - https://web.archive.org/web/20081202152159/http://www.webreference.com/html/tutorial8/7.html


spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

An Inquiry Into Values

Example: Units compared


Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management

This document shows the various units in action. There are seven paragraphs in each section, and each has an indent specified in a different unit. All indents except for the last one in each section are equal to 1 inch. The absolute units used are set at the correct values to be equal (1 inch = 2.54 cm = 25.4 mm = 72pt = 6pc). The relative values for em and ex are different for each section, but are also equal to an inch (12em = 12 × 6pt = 6em = 6 × 12pt = 4em = 4 × 18pt = 72pt = 1in). The pixel measurements cannot be set to exactly one inch (unless you happen to have a display with exactly 100dpi resolution), which is an example of the weakness of this unit.

Normally, the ex values should not be equal to an inch, but both Explorer and Navigator set an ex to be equal to half an em, rendering the value slightly useless. Also, you'll notice that Navigator doesn't quite get the em and ex values right; another case of Navigator inheriting actual values instead of computed values, most probably.

BODY {
 background-color: black;
 color: white;
}
DIV.six P {
 font-size: 6pt;
}
DIV.twelve P {
 font-size: 12pt;
}
DIV.eighteen P {
 font-size: 18pt;
}
P.blurb {
 color: black;
 font-size: medium !important;
}
P {
 margin: 0.1cm;
}
DIV {
 background-color: white;
 border: solid 2px black;
}
SPAN {
 background-color: #888;
}
<DIV CLASS="six">
<P CLASS="blurb">Absolute and relative units with 6pt text:</P>
<P STYLE="text-indent: 25.4mm"><SPAN>This is a paragraph with 25.4mm of
indent.</SPAN></P>
<P STYLE="text-indent: 2.54cm"><SPAN>This is a paragraph with 2.54cm of
indent.</SPAN></P>
<P STYLE="text-indent: 1in"><SPAN>This is a paragraph with 1in of
indent.</SPAN></P>
<P STYLE="text-indent: 72pt"><SPAN>This is a paragraph with 72pt of
indent.</SPAN></P>
<P STYLE="text-indent: 6pc"><SPAN>This is a paragraph with 6pc of
indent.</SPAN></P>
<P STYLE="text-indent: 12em"><SPAN>This is a paragraph with 12em of
indent.</SPAN></P>
<P STYLE="text-indent: 24ex"><SPAN>This is a paragraph with 24ex of
indent.</SPAN></P>
<P STYLE="text-indent: 100px"><SPAN>This is a paragraph with 100px of
indent.</SPAN></P>
</DIV>

<DIV CLASS="twelve">
<P CLASS="blurb">Absolute and relative units with 12pt text:</P>
<P STYLE="text-indent: 25.4mm"><SPAN>This is a paragraph with 25.4mm of
indent.</SPAN></P>
<P STYLE="text-indent: 2.54cm"><SPAN>This is a paragraph with 2.54cm of
indent.</SPAN></P>
<P STYLE="text-indent: 1in"><SPAN>This is a paragraph with 1in of
indent.</SPAN></P>
<P STYLE="text-indent: 72pt"><SPAN>This is a paragraph with 72pt of
indent.</SPAN></P>
<P STYLE="text-indent: 6pc"><SPAN>This is a paragraph with 6pc of
indent.</SPAN></P>
<P STYLE="text-indent: 6em"><SPAN>This is a paragraph with 6em of
indent.</SPAN></P>
<P STYLE="text-indent: 12ex"><SPAN>This is a paragraph with 12ex of
indent.</SPAN></P>
<P STYLE="text-indent: 100px"><SPAN>This is a paragraph with 100px of
indent.</SPAN></P>
</DIV>

<DIV CLASS="eighteen">
<P CLASS="blurb">Absolute and relative units with 12pt text:</P>
<P STYLE="text-indent: 25.4mm"><SPAN>This is a paragraph with 25.4mm of
indent.</SPAN></P>
<P STYLE="text-indent: 2.54cm"><SPAN>This is a paragraph with 2.54cm of
indent.</SPAN></P>
<P STYLE="text-indent: 1in"><SPAN>This is a paragraph with 1in of
indent.</SPAN></P>
<P STYLE="text-indent: 72pt"><SPAN>This is a paragraph with 72pt of
indent.</SPAN></P>
<P STYLE="text-indent: 6pc"><SPAN>This is a paragraph with 6pc of
indent.</SPAN></P>
<P STYLE="text-indent: 4em"><SPAN>This is a paragraph with 4em of
indent.</SPAN></P>
<P STYLE="text-indent: 8ex"><SPAN>This is a paragraph with 8ex of
indent.</SPAN></P>
<P STYLE="text-indent: 100px"><SPAN>This is a paragraph with 100px of
indent.</SPAN></P>
</DIV>

Front Page12345678

http://www.internet.com

Produced by Stephanos Piperoglou

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Copyright 2008 Jupitermedia Corporation All Rights Reserved.

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags


All Rights Reserved. Legal Notices.

URL: http://www.webreference.com/html/tutorial8/
Created: Oct 30, 1998
Revised: Nov 4, 1998

Morty Proxy This is a proxified and sanitized view of the page, visit original site.