<?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>SoftLayer Blog &#187; height</title>
	<atom:link href="http://blog.softlayer.com/tag/height/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.softlayer.com</link>
	<description>A Behind the Scenes Look at the Best Hosting Provider in the World</description>
	<lastBuildDate>Wed, 15 May 2013 15:33:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Tips and Tricks &#8211; Pure CSS Sticky Footers</title>
		<link>http://blog.softlayer.com/2012/tips-and-tricks-pure-css-sticky-footers/</link>
		<comments>http://blog.softlayer.com/2012/tips-and-tricks-pure-css-sticky-footers/#comments</comments>
		<pubDate>Tue, 06 Nov 2012 20:00:17 +0000</pubDate>
		<dc:creator>Cassandra Wolff</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[compatibility]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[developer]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[height]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[sticky footer]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=9491</guid>
		<description><![CDATA[By now, if you&#8217;ve seen my other blog posts, you know that I&#8217;m fascinated with how much JavaScript has evolved and how much you can do with jQuery these days. I&#8217;m an advocate of working smarter, not harder, and that maxim knows no coding language limits. In this post, I want to share a pure [...]]]></description>
			<content:encoded><![CDATA[<p>By now, if you&#8217;ve seen my other blog posts, you know that I&#8217;m fascinated with how much <a href="http://blog.softlayer.com/?s=javascript">JavaScript</a> has evolved and how much you can do with <a href="http://blog.softlayer.com/?s=jquery">jQuery</a> these days. I&#8217;m an advocate of working smarter, not harder, and that maxim knows no coding language limits. In this post, I want to share a pure CSS solution that allows for &#8220;sticky&#8221; footers on a web page. In comparing several different techniques to present this functionality, I found that all of the other routes were overkill when it came to processing time and resource usage.</p>
<p>Our objective is simple: Make the footer of our web page stay at the bottom even if the page&#8217;s content area is shorter than the user&#8217;s browser window.</p>
<p>This, by far, is one of my *favorite* things to do. It makes the web layout so much more appealing and creates a very professional feel. I ended up kicking myself the very first time I tried to add this functionality to a project early in my career (ten years ago &#8230; already!?) when I found out just how easy it was. I take solace in knowing that I&#8217;m not alone, though &#8230; A quick search for &#8220;footer stick bottom&#8221; still yields quite a few results from fellow developers who are wrestling with the same frustrating experience I did. If you&#8217;re in that boat, fear no more! We&#8217;re going to your footers in shape in a snap.</p>
<p>Here&#8217;s a diagram of the problem:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/headerfootercss.jpg" alt="CSS Footer"/></p>
<p>Unfortunately, a lot of people try to handle it with setting a fixed height to the content which would push the footer down. This may work when YOU view it, but there are several different browser window heights, resolutions and variables that make this an *extremely* unreliable solution (notice the emphasis on the word &#8220;extremely&#8221; &#8230; this basically means &#8220;don&#8217;t do it&#8221;).</p>
<p>We need a dynamic solution that is able to adapt on the fly to the height of a user&#8217;s browser window regardless if the resize it, have Firebug open, use a unique resolution or just have a really, really weird browser!</p>
<p>Let&#8217;s take a look at what the end results should look like:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/headerfootercss2.jpg" alt="CSS Footer"/></p>
<p>To make this happen, let&#8217;s get our HTML structure in place first:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;page&quot;</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;main&quot;</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;footer&quot;</span>&gt;</span> <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>It&#8217;s pretty simple so far &#8230; Just a skeleton of a web page. The <code>page</code> div contains ALL elements and is immediately below the <body> tags in the page code hierarchy. The <code>header</code> div is going to be our top content, the <code>main</code> div will include all of our content, and the <code>footer</code> div is all of our copyrights and footer links.</p>
<p>Let&#8217;s start by coding the CSS for the full page:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">Html<span style="color: #00AA00;">,</span> body <span style="color: #00AA00;">&#123;</span>
      Padding<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
      Margin<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
      Height<span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Adding a 100% height allows us to set the height of the <code>main</code> div later. The height of a div can only be as tall as the parent element encasing it. Now let&#8217;s see how the rest of our ids are styled:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#page</span> <span style="color: #00AA00;">&#123;</span>
      Min-<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
      <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#main</span> <span style="color: #00AA00;">&#123;</span>
      Padding-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">75px</span><span style="color: #00AA00;">;</span>   <span style="color: #808080; font-style: italic;">/* This value is the height of your footer */</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span>
      Position<span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
      Width<span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>
      Bottom<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
      Height<span style="color: #00AA00;">:</span> <span style="color: #933;">75px</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* This value is the height of your footer */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>These rules position the footer &#8220;absolutely&#8221; at the bottom of the page, and because we set <code>#page</code> to <code>min-height: 100%</code>, it ensures that <code>#main</code> is exactly the height of the browser&#8217;s viewing space. One of the best things about this little trick is that it&#8217;s compliant with all major current browsers &mdash; including Firefox, Chrome, Safari *AND* Internet Explorer (after a little tweak). For Internet Explorer to not throw a fit, we need concede that IE doesn&#8217;t recognize <code>min-height</code> as a valid property, so we have to add <code>Height: 100%;</code> to <code>#page</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#page</span> <span style="color: #00AA00;">&#123;</span>
      Min-<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* for all other browsers */</span>
      <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* for IE */</span>
      <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>If the user does not have a modern, popular browser, it&#8217;s still okay! Though their old browser won&#8217;t detect the magic we&#8217;ve done here, it&#8217;ll fail gracefully, and the footer will be positioned directly under the content, as it would have been without our little CSS trick.</p>
<p>I can&#8217;t finish this blog without mentioning my FAVORITE perk of this trick: Should you not have a specially designed mobile version of your site, this trick even works on smart phones!</p>
<p>-Cassandra</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/tips-and-tricks-pure-css-sticky-footers/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Tips and Tricks &#8211; jQuery equalHeights Plugin</title>
		<link>http://blog.softlayer.com/2012/tips-and-tricks-jquery-equalheights-plugin/</link>
		<comments>http://blog.softlayer.com/2012/tips-and-tricks-jquery-equalheights-plugin/#comments</comments>
		<pubDate>Thu, 06 Sep 2012 20:05:31 +0000</pubDate>
		<dc:creator>Cassandra Wolff</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[divs]]></category>
		<category><![CDATA[equalHeights]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[height]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tip]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.softlayer.com/?p=9190</guid>
		<description><![CDATA[Last month, I posted a blog about dynamically resizing divs with jQuery, and we received a lot of positive feedback about it. My quest to avoid iframes proved to be helpful, so I thought I&#8217;d share a few more esoteric jQuery tips and tricks that may be of use to the developers and designers in [...]]]></description>
			<content:encoded><![CDATA[<p>Last month, I posted a blog about <a href="http://blog.softlayer.com/2012/no-iframes-dynamically-resize-divs-with-jquery/">dynamically resizing divs with jQuery</a>, and we received a lot of positive feedback about it. My quest to avoid iframes proved to be helpful, so I thought I&#8217;d share a few more esoteric jQuery tips and tricks that may be of use to the developers and designers in the audience. As I thought back about other challenges I&#8217;ve faced as a coder, a great example came to mind: Making divs equal height, regardless of the amount of content inside.</p>
<p>I haven&#8217;t seen many elegant div-based solutions for that relatively simple (and common) task, so I&#8217;ve noticed that many people struggle with it. Often, developers will turn back to the &#8220;Dark Side&#8221; of using tables to format the content since all columns would have the same height as the tallest column by default:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/jquery1.png" alt="JQuery Tutorial"/></p>
<p>It was easy theme table columns and to achieve the coveted 100% height that many designers seek, but emulating that functionality with divs proves to be much more difficult. A div is like the Superman of HTML elements (faster-loading, more flexible, more dynamic, etc.), and while it has super powers, it also has its own Kryptonite-like weaknesses &#8230; The one relevant to this blog post being that floating three div elements next to each other isn&#8217;t going to give you the look of a table:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/jquery2.png" alt="JQuery Tutorial"/></p>
<p>Each of the three divs has its own height, so if you&#8217;re doing something as simple as applying background colors, you&#8217;re going to wind up with an aesthetically unpleasing result: It&#8217;s going to look funky.</p>
<p>You could get into some nifty HTML/CSS workarounds, but many frustrated theme creators and designers will tell you that if your parent elements don&#8217;t have a height of a 100%, you&#8217;re just wasting coding lines. Some complex solutions create the illusion of all three divs being the same height (which is arguably better than setting fixed heights), but that complexity can be difficult to scale and repeat if you need to perform similar tasks throughout your site or your application. The easiest way to get the functionality you want and the simplicity you need: The <a href="http://www.cssnewbie.com/download/jquery.equalheights.js">jQuery equalHeights</a> plugin!</p>
<p>With a few class declarations in your existing HTML, you get the results you want, and with equalHeights, you can also specify the minimum and maximum parameters so it will create scrollable divs if the tallest element happens to be higher than your specified maximum.</p>
<h3>How to Use jQuery equalHeights</h3>
<p>First and foremost, include your JQuery lirbraries in the <code>&lt;HEAD&gt;</code> of your document:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;script language</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;jquery.equalheights.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The equalHeights plugin is not a hosted library, so you have to host the file on your server (<a href="http://www.cssnewbie.com/download/jquery.equalheights.js">here&#8217;s the link again</a>).</p>
<p>With the required libraries called in our document, it&#8217;s time to make the magic happen in your HTML.</p>
<p><strong>Create Your Divs</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;divHeight&quot;</span>&gt;</span>This DIV is medium sized, not too big and not too small, but just right.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;divHeight&quot;</span>&gt;</span>This DIV has a lot of useful content and media that the user can interact with, thus it's very tall.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;divHeight&quot;</span>&gt;</span>This DIV is tiny. Period.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>To have them line up next to each other, you&#8217;d have them <code>float:left;</code> in your CSS, and now you need to apply the equalHeights function.</p>
<p><strong>Call the equalHeights Plugin</strong><br />
In order for the script to recognize the height of the tallest element, you&#8217;d need to call <code>$(document).ready</code> just before the <code>&lt;/body&gt;</code> tag on your page. This will ensure that the page loads before the function runs. </p>
<p>The call looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.divHeight&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">equalHeights</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>If you want to specify a minimum and maximum (i.e. The div should be at least this tall and should be no taller than [adds scrollbar if the div size exceeds] the maximum), just add the parameters:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.divHeight&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">equalHeights</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">300</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The initial call does not change the appearance of the divs, but the time it takes to do the resizing is so miniscule that users will never notice. After that call is made and the height is returned, each div with the class of <code>divHeight</code> will inherit the the same height, and your divs will be nice and pretty:</p>
<p><img class="centered" src="http://cdn.softlayer.com/innerlayer/jquery3.png" alt="JQuery Tutorial"/></p>
<p>This trick saved me a lot of headache and frustration, so hopefully it will do the same for you too!</p>
<p>-Cassandra</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.softlayer.com/2012/tips-and-tricks-jquery-equalheights-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
