<?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; ex</title>
	<atom:link href="http://www.saffronstroke.com/tag/ex/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>Unitless Line Heights in CSS</title>
		<link>http://www.saffronstroke.com/2009/06/16/unitless-line-heights-in-css/</link>
		<comments>http://www.saffronstroke.com/2009/06/16/unitless-line-heights-in-css/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 09:30:19 +0000</pubDate>
		<dc:creator>Minal</dc:creator>
				<category><![CDATA[CSS Hacks, Tips and Tricks]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[em]]></category>
		<category><![CDATA[ex]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[line height]]></category>
		<category><![CDATA[unit less line height]]></category>
		<category><![CDATA[unitless line height]]></category>

		<guid isPermaLink="false">http://saffronstroke.com/?p=551</guid>
		<description><![CDATA[One of my fellow designers asked me the other day, what are unitless line-heights and how do they work. And I remembered what Eric Meyer’s post on ‘Unitless line-heights’. I was new to designing then and used the old methods of specifying line height in pixels or percentages. Well that was until I came across [...]]]></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/06/16/unitless-line-heights-in-css/"></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%2F06%2F16%2Funitless-line-heights-in-css%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.saffronstroke.com%2F2009%2F06%2F16%2Funitless-line-heights-in-css%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>One of my fellow designers asked me the other day, what are unitless line-heights and how do they work. And I remembered what Eric Meyer’s post on ‘Unitless line-heights’. I was new to designing then and used the old methods of specifying line height in pixels or percentages. Well that was until I came across that post. Then I tried it and found it was a genius option as the output would not be affected by browsers. This article explains how line-height can be unitless. Let us first understand the different values line-height property can take.</p>
<p>The line-height property refers to the distance between the baselines of lines of text. In other words it is the vertical space between lines of text. The image below would help you understand the property in a better way.</p>
<p> <img class="alignnone size-full wp-image-552" title="overlap" src="http://www.saffronstroke.com/wp-content/uploads/2009/06/overlap.jpg" alt="overlap" width="174" height="37" /></p>
<p><img class="alignnone size-full wp-image-553" title="neat" src="http://www.saffronstroke.com/wp-content/uploads/2009/06/neat.jpg" alt="neat" width="176" height="40" /> </p>
<p>Line height could be specified using absolute or relative values.</p>
<p>Absolute values such as pixels (px), points (pt), picas (pc), percentage (%), inches (in), centimeters (cm) and millimeters (mm). Relative values could be em and ex. Line height defined in px, pt, pc, in, cm and mm set a fixed distance between the lines. % on the other hand sets the distance as a % of the current font-size. For example,</p>
<p>&lt;p style=&#8221;font-size: 20px; line-height: 100 %;&#8221;&gt; Some Text&lt;/p&gt; will set the line-height equal to its font-size 20px.</p>
<p>Where ‘em’ is defined to be the value of font-size given, ‘ex’ refers to the height of the lowercase x in the font used. For more details on ‘em and ex’ read <a href="http://saffronstroke.com/2009/04/25/difference-between-em-and-ex-units">Difference between &#8216;em&#8217; and &#8216;ex&#8217; units</a></p>
<p>If a line-height is defined without a unit, that a ‘Unitless’ height. Simple, isn’t it. See this example;</p>
<p>&lt;p style=&#8221;font-size: 20px; line-height: 1 ;&#8221;&gt; Some Text&lt;/p&gt;</p>
<p>The value for line-height will be interpreted as it current font size. It is calculated by multiplying the current font-size with the numerical value of line-height. So the line height would now be 20px. Yes yes I know what your next question is; what is the difference between the percentage and unitless value since their result is the same. Consider this example:</p>
<p>body { font-size: 20px; line-height: 100%;}</p>
<p>p { font-size: 15px; }</p>
<p>small { font-size: 10px}</p>
<p>&lt;body&gt;</p>
<p>                &lt;p&gt;This is a para with &lt;small&gt; text &lt;/small&gt;&lt;/p&gt;</p>
<p>&lt;/body&gt;</p>
<p>The line-height for body is 100% of 20px = 20px. This is interpreted as line-height: 20px. This computed value is inherited by &lt;p&gt; and &lt;small&gt;. Hence the line-height for all three elements would be same. And now consider following example:</p>
<p>body { font-size: 20px; line-height: 1;}</p>
<p>p { font-size: 15px; }</p>
<p>small { font-size: 10px}</p>
<p>&lt;body&gt;</p>
<p>                &lt;p&gt;This is a para with &lt;small&gt; text &lt;/small&gt;&lt;/p&gt;</p>
<p>&lt;/body&gt;</p>
<p>In this case the line-height computed for &lt;body&gt; is 20px, but the line-height value that is inherited is 1 and not the computed value. Hence when the value 1 is inherited by &lt;p&gt; the line-height for paragraph is 15px and for &lt;small&gt; will be 10px.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saffronstroke.com/2009/06/16/unitless-line-heights-in-css/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>

