<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Saffron Stroke - Your Web Design Resource &#187; relative units</title>
	<atom:link href="http://www.saffronstroke.com/tag/relative-units/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.saffronstroke.com</link>
	<description>Design Blog</description>
	<lastBuildDate>Wed, 11 Jan 2012 06:36:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Difference between &#039;em&#039; and &#039;ex&#039; units</title>
		<link>http://www.saffronstroke.com/2009/04/25/difference-between-em-and-ex-units/</link>
		<comments>http://www.saffronstroke.com/2009/04/25/difference-between-em-and-ex-units/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 12:54:59 +0000</pubDate>
		<dc:creator>Minal</dc:creator>
				<category><![CDATA[Expression Web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[em]]></category>
		<category><![CDATA[ex]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[relative units]]></category>
		<category><![CDATA[relative values]]></category>
		<category><![CDATA[units]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://saffronstroke.com/?p=463</guid>
		<description><![CDATA[‘em’ and ‘ex’ units are both relative units; viz. they are measured in relation to other values. In CSS, one &#8216;em&#8217; is defined to be the value of font-size of a given element. For example, if the font-size of a paragraph element is 12 pixels then 1em = 12 px. But as I already mentioned [...]]]></description>
			<content:encoded><![CDATA[<div align="left" style="float: none; clear:right; padding: 0px 5px 5px 0px;"><a name="fb_share" type="button_count" share_url="http://www.saffronstroke.com/2009/04/25/difference-between-em-and-ex-units/"></a></div><div class="tweetmeme_button" style="float: right; margin-left: 10px;; margin-top:-2px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.saffronstroke.com%2F2009%2F04%2F25%2Fdifference-between-em-and-ex-units%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.saffronstroke.com%2F2009%2F04%2F25%2Fdifference-between-em-and-ex-units%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">‘em’ and ‘ex’ units are both relative units; viz. they are measured in relation to other values. </span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">In CSS, one &#8216;em&#8217; is defined to be the value of font-size of a given element. For example, if the font-size of a paragraph element is 12 pixels then 1em = 12 px.</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">But as I already mentioned &#8216;em&#8217; value depends on the element with which it is used. Consider following example.</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">p {font-size: 12px; padding-left: 1em;}</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">h1 {font-size: 22px; padding-left: 1em;}</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">The output would be:</span> </p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;"><img class="alignnone size-full wp-image-464" title="em_padding" src="http://www.saffronstroke.com/wp-content/uploads/2009/04/em_padding.jpg" alt="em_padding" width="399" height="78" /></span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">This is because; the value of &#8216;em&#8217; is relative to its parent. So the left padding for the paragraph was 12px whereas left padding for Heading 1 was 22px. </span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><span style="font-size:small;font-family:Calibri;">&#8216;ex&#8217; on the other hand refers to the height of the lowercase letter &#8216;x&#8217; in the font that is assigned for a given element. Different fonts have different heights for &#8216;x&#8217; even if their font-size is same. Hence the value of &#8216;ex&#8217; differs from font to font. Take a look at these fonts:</span></p>
<p class="MsoNormal" style="margin:0 0 10pt;"><img class="alignnone size-full wp-image-465" title="ex_sizes" src="http://www.saffronstroke.com/wp-content/uploads/2009/04/ex_sizes.jpg" alt="ex_sizes" width="460" height="163" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saffronstroke.com/2009/04/25/difference-between-em-and-ex-units/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

