<?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>The Bright Lines &#187; paragraph</title>
	<atom:link href="http://www.thebrightlines.com/tag/paragraph/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thebrightlines.com</link>
	<description>HTML, CSS, Javascript and more</description>
	<lastBuildDate>Thu, 29 Jul 2010 22:44:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Differences between Photoshop web design and HTML. Part 1: line height</title>
		<link>http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/</link>
		<comments>http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 00:41:15 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[first-child]]></category>
		<category><![CDATA[line-height]]></category>
		<category><![CDATA[paragraph]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=293</guid>
		<description><![CDATA[Discusses the different effects when setting the line-height in Photoshop and in HTML. It's something to keep in mind when converting PSD to HTML/CSS.]]></description>
			<content:encoded><![CDATA[<p>Photoshop is *the* tool for designing websites. To illustrate its popularity: In my 10 years in web development I hardly encountered anything else. Attempts to design websites in line drawings always failed. In those few cases a design firm did sent their webdesign in Illustrator or PDF, it would have a fair chance of being converted to Photoshop by hand before any HTML was written.</p>
<p>But like anything Photoshop has its weak points. And since we humans tend to focus on those tiny grains of imperfections I decided to sum up the troubles you can encounter when converting a Photoshop document into to a real website.</p>
<h2>Line height between paragraphs</h2>
<p>One thing that definitely can be confusing is the line height of text. When increasing the line height in Photoshop by setting the &#8216;leading&#8217;, the extra space is added <em>above</em> the text. In HTML That extra space is distributed <em>above and below</em> the text. Below you can see the differences next to each other.</p>
<div class="wp-caption alignleft" style="width: 167px"><img title="A large line-height in Photoshop adds space above the text" src="/article-data/images/Photoshop-1.png" alt="A large line-height in Photoshop adds space above the text" width="157" height="103" /><p class="wp-caption-text">A large line-height in Photoshop adds space above the text</p></div>
<div class="wp-caption alignleft" style="width: 167px"><img title="A large line-height in HTML/CSS adds space above and below the text" src="/article-data/images/Photoshop-2.png" alt="A large line-height in HTML/CSS adds space above and below the text" width="157" height="103" /><p class="wp-caption-text">A large line-height in HTML/CSS adds space above and below the text</p></div>
<div class="wp-caption alignleft" style="width: 223px"><img title="Activate this window in the menu throught Window &gt; Character" src="/article-data/images/Photoshop-3.png" alt="Activate this window in the menu throught Window &gt; Character" width="213" height="214" /><p class="wp-caption-text">Activate this window in the menu throught Window &gt; Character</p></div>
<p>Many designers use line-height to create paragraphs. So if you want to know how much margin you have to set on paragraphs, you have to look at line-height of the first line in a paragraph. In short: <strong>Line-height of the first line &#8211; default line-height = the margin between paragraphs</strong>. That&#8217;s why I never look at the line height of the first line of text in a paragraph in Photoshop.</p>
<h2>Line height of the first line in a text box</h2>
<p>Another thing to be aware of is that the line-height has <em>absolutely no effect in the first line of a text box</em>. So it doesn&#8217;t matter if you set the line-height to 20px or 40px. No extra white space is added on top of the text. HTML does not follow Photoshop&#8217;s behaviour.</p>
<p>Because of that you have to be aware that different styles with different line heights in a website can push the whole text box up or down. That&#8217;s especially important when the first line of a text box should align with some box or image on the left or right as you can see in the examples below.</p>
<div class="wp-caption alignleft" style="width: 260px"><img title="The solid box and text box are aligned (line-height: 20px)." src="/article-data/images/Photoshop-4.png" alt="The solid box and the text box are aligned (line-height: 20px)." width="250" height="105" /><p class="wp-caption-text">The solid box and the text box are aligned (line-height: 20px).</p></div>
<div class="wp-caption alignleft" style="width: 260px"><img title="...but when a heading is added with 40px line-height it does not align anymore." src="/article-data/images/Photoshop-5.png" alt="...but when a heading is added with 40px line-height it does not align anymore." width="250" height="105" /><p class="wp-caption-text">...but when a heading is added with 40px line-height it does not align anymore.</p></div>
<p>You could fix the problem above with this CSS:</p>
<pre class="css:nogutter">.textBox h1:first-child {
    margin-top: -10px; /* only half of the extra line-height has to be compensated */
    font-size: 20px;
    line-height: 40px;
}</pre>
<p>The <code>first-child</code> selector ensures us that the negative margin is only used on something that&#8217;s on the very top of the text-box. As already said, the line-height is distributed above and below the text. So we only have to compensate for the extra space on the upper part of the line. So:</p>
<p><strong>40px</strong> (line-height) <strong>- 20px</strong> (font-size) <strong>= 10px</strong> (the value for our negative top margin).</p>


<p>Related posts:<ol><li><a href='http://www.thebrightlines.com/2010/01/07/do-you-create-your-design-in-photoshop-or-notepad/' rel='bookmark' title='Permanent Link: Do you create your design in Photoshop or Notepad?'>Do you create your design in Photoshop or Notepad?</a></li>
<li><a href='http://www.thebrightlines.com/2009/11/05/3-tips-for-making-css-sprites-in-photoshop/' rel='bookmark' title='Permanent Link: 3 Tips for making CSS sprites in Photoshop'>3 Tips for making CSS sprites in Photoshop</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/12/26/differences-between-photoshop-web-design-and-html-part-1-line-height/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
