<?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>Jared Heinrichs &#187; HTML</title>
	<atom:link href="http://jaredheinrichs.com/category/programming/html/feed" rel="self" type="application/rss+xml" />
	<link>http://jaredheinrichs.com</link>
	<description>A Winnipeg &#34;How to&#34; Blog on Software and Technology</description>
	<lastBuildDate>Sat, 19 May 2012 22:43:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Errors newbies make when coding HTML.</title>
		<link>http://jaredheinrichs.com/errors-newbies-make-when-coding-html.html</link>
		<comments>http://jaredheinrichs.com/errors-newbies-make-when-coding-html.html#comments</comments>
		<pubDate>Thu, 18 Nov 2010 04:29:57 +0000</pubDate>
		<dc:creator>Jared Heinrichs</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://jaredheinrichs.com/errors-newbies-make-when-coding-html.html</guid>
		<description><![CDATA[I think that most newbies make when they start coding web sites is that the different tags have some super-duper special powers. Actually, I don’t think that. I do think that newbies think that there is at least some magic &#8230; <a href="http://jaredheinrichs.com/errors-newbies-make-when-coding-html.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I think that most newbies make when they start coding web sites is that the different tags have some super-duper special powers. Actually, I don’t think that. I do think that newbies think that there is at least some magic going on behind the scenes.</p>
<p>The biggest piece of advise I can give a person is:</p>
<ol>
<li>Find out what a tag does!</li>
<li>How is it similar to other tags?</li>
<li>How is it different?</li>
</ol>
<p>What is the difference between a newbie and a Master web developer? Newbies normally can tell you what something does but they don’t know why it does what it does. How things work (ie inner working knowledge) will really help you excel.</p>
<p>1.) If I were to ask you “What is the default position of block level element” would you be able to tell me? I bet most people can’t respond to that without looking that up. The answer to the question was “STATIC”.</p>
<p>2.) Two of the most confusing styling style properties are:</p>
<ol>
<li>Whether an “element is block or inline” by default</li>
<li>What the default positioning of an element is. (We just found out this is STATIC)</li>
</ol>
<p>Not knowing these things will limit your designs and force you to use hacks.</p>
<p>If you don’t know what either of those two items are. Don’t worry.</p>
<h2>Definition of Block level elements</h2>
<p>To sum it up best. Block level elements are containers. </p>
<p>They can contain other block level elements as well as inline elements. They start new lines of text when you use them. A block-level element is an element that creates large blocks of content like paragraphs or page divisions. </p>
<p>Block level elements can have width, height, Max-width,max-height, min-width and min-height applied to them.</p>
<p><a href="http://htmlhelp.com/reference/html40/block.html" target="_blank">What are the elements that are considered block level elements?</a></p>
<h2>Definition of an inline element</h2>
<p>To sum it up best inline elements become part of the HTML flow of the containing Block/inline level element. Inline elements can only contain other inline elements</p>
<p><a href="http://htmlhelp.com/reference/html40/inline.html" target="_blank">What are the elements that are considered inline elements?</a></p>
<h3>Want to get really confused?</h3>
<p>Here’s the real kicker. Remember when I went on that little bit of the rant at the top of the page about some things that seem to be magical? Well there was a reason for it. LOL. Even though the lists I linked to&#160; say an element is inline there is NOTHING stopping you from making it a block level element. While I don’t recommend changing elements to what ever you feel like, I do think there are a couple instances that you might need to change between a block and inline Element.</p>
<p>Horizontal List Menus – By default most lists are displayed vertically. If you want to have the horizontal you have no other option but to change them from block to inline.</p>
<p>Headers inside text. Say you want a header to remain in the text flow so that the rest of the text just seems to flow as if it was no break you’d need to make it inline.</p>
<p>There is actually one more option to take about when talking about inline or block level elements. The third thing an element can be is “hidden”. If something is classified as hidden then it will not be displayed on the page.</p>
<h2>Positioning</h2>
<p>I think one of the best articles of all time on positioning can be found at CSS-TRICKS. I’m not even going to bother re-hashing a perfect post.</p>
<p><a title="http://css-tricks.com/absolute-positioning-inside-relative-positioning/" href="http://css-tricks.com/absolute-positioning-inside-relative-positioning/">http://css-tricks.com/absolute-positioning-inside-relative-positioning/</a></p>
<p>Hope you learned a thing or two.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaredheinrichs.com/errors-newbies-make-when-coding-html.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image shows in IE, Chrome and Safari but NOT Firefox</title>
		<link>http://jaredheinrichs.com/image-shows-in-ie-chrome-and-safari-but-not-firefox.html</link>
		<comments>http://jaredheinrichs.com/image-shows-in-ie-chrome-and-safari-but-not-firefox.html#comments</comments>
		<pubDate>Thu, 14 Oct 2010 16:20:45 +0000</pubDate>
		<dc:creator>Jared Heinrichs</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://jaredheinrichs.com/image-shows-in-ie-chrome-and-safari-but-not-firefox.html</guid>
		<description><![CDATA[I’m a big believer in the check often mentality when it comes to programming. Unfortunately I was racing to get some work done and I made a mistake that hopefully other people will benefit from. I also wanted to let &#8230; <a href="http://jaredheinrichs.com/image-shows-in-ie-chrome-and-safari-but-not-firefox.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I’m a big believer in the check often mentality when it comes to programming. Unfortunately I was racing to get some work done and I made a mistake that hopefully other people will benefit from. I also wanted to let you know I do most of my testing in IE. If there is going to be an issue, I will normally see it first in that browser. Today it was “firefox” that seemed to have the issue. It turned out I was just sloppy. Take a look at this code:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">src</span><span class="kwrd">=&quot;\images\line-break.jpg&quot;</span> <span class="attr">class</span><span class="kwrd">=&quot;lineBreak&quot;</span> <span class="kwrd">/&gt;</span></pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>While you might think that looks ok, it turns out there are issues with that code. The two issues are only an issue in Firefox. The issue why that image will not display in Firefox is that FireFox does not like “\” for defining folder structure.</p>
<p>If you use this code everything will look fine across all browsers.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">src</span><span class="kwrd">=&quot;/images/line-break.jpg&quot;</span> <span class="attr">class</span><span class="kwrd">=&quot;lineBreak&quot;</span> <span class="kwrd">/&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>I don’t know why I accidentally typed in “\” instead of a “/” but it’s nice to know what each browser is capable of.</p>
]]></content:encoded>
			<wfw:commentRss>http://jaredheinrichs.com/image-shows-in-ie-chrome-and-safari-but-not-firefox.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How you can use HTML5 now even with older browsers</title>
		<link>http://jaredheinrichs.com/how-you-can-use-html5-now-even-with-older-browsers.html</link>
		<comments>http://jaredheinrichs.com/how-you-can-use-html5-now-even-with-older-browsers.html#comments</comments>
		<pubDate>Tue, 02 Feb 2010 04:01:57 +0000</pubDate>
		<dc:creator>Jared Heinrichs</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://jaredheinrichs.com/how-you-can-use-html5-now-even-with-older-browsers.html</guid>
		<description><![CDATA[I’ve been reading up on HTML5 lately. I’ve got to say that the HTML5 code is so much cleaner. Unfortunately browsers like Internet Explorer 6 don’t understand some of the new elements that make up HTML 5 unless you tell &#8230; <a href="http://jaredheinrichs.com/how-you-can-use-html5-now-even-with-older-browsers.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I’ve been reading up on HTML5 lately. I’ve got to say that the HTML5 code is so much cleaner. Unfortunately browsers like Internet Explorer 6 don’t understand some of the new elements that make up HTML 5 unless you tell it to them yourself.</p>
<p>What are some of the new elements you say? Well without further adieu here are the main additions to web layout:</p>
<ul>
<li>header</li>
<li>section</li>
<li>footer</li>
<li>aside</li>
<li>nav</li>
<li>article</li>
<li>figure</li>
</ul>
<p>You might be asking what is the big deal with these being added to HTML5? Well up until now most people would do something similar to this to create a header section:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">div</span> <span style="color: #ff0000">id</span>=<span style="color: #0000ff">&quot;header&quot;</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">   some code goes here
</pre>
<blockquote><pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">div</span><span style="color: #0000ff">&gt;</span></pre>
</blockquote>
</pre>
<p>&#160;</p>
<p>Things like search engines don’t really understand that the last piece of code is the header. To top it off when pages start getting a ton of &lt;div&gt;’s, it makes it much harder to read the code then what HTML5 brings to the table. </p>
<p>Here is the same HTML container but now we are using the “header” section that is part of HTML5:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">header</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    some code goes here...
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">header</span><span style="color: #0000ff">&gt;</span></pre>
</pre>
<p>&#160;</p>
<p>HTML5 also helps to make the CSS easier read and follow. Here is the example of css for both the &lt;div&gt; approach and the new HTML5 approach.</p>
<p>Old &lt;div&gt; approach:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">#header</span>    { <span style="color: #ff0000">width</span>:<span style="color: #0000ff">1000px</span>; <span style="color: #ff0000">height</span>: <span style="color: #0000ff">300px</span>; }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">#header</span> <span style="color: #800000">h1</span> { <span style="color: #ff0000">font</span>: <span style="color: #0000ff">bold 20px Helvetica, Sans-serif</span>; <span style="color: #ff0000">margin</span>: <span style="color: #0000ff">0 0 10px 0</span>; }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">#nav</span>    { <span style="color: #ff0000">width</span>:1000px }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">#footer</span> { <span style="color: #ff0000">width</span>:1000px }</pre>
</pre>
<p>&#160;</p>
<p>New HTML5 approach:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">header</span> { <span style="color: #ff0000">width</span>:<span style="color: #0000ff">1000px</span>; <span style="color: #ff0000">height</span>: <span style="color: #0000ff">300px</span>; }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">header</span> <span style="color: #800000">h1</span> { <span style="color: #ff0000">font</span>: <span style="color: #0000ff">bold 20px Helvetica, Sans-serif</span>; <span style="color: #ff0000">margin</span>: <span style="color: #0000ff">0 0 10px 0</span>; }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">nav</span>    { <span style="color: #ff0000">width</span>:1000px }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">footer</span> { <span style="color: #ff0000">width</span>:1000px }</pre>
</pre>
<p>&#160;</p>
<p>As you can see the new elements will provide a type of meta data to the browser and search engines letting it know where the main content is on the page. This should help with SEO (search engine optimization).</p>
<p>For most browsers you will need to add the elements to the HTML document by doing three things:</p>
<p>Set the new Doc Type:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span>!DOCTYPE html<span style="color: #0000ff">&gt;</span></pre>
</pre>
<p>&#160;</p>
<p>Second we have to tell the browser to treat the new items as Block Type elements using CSS. Once we create the CSS file all we have to do then is to link the CSS to the page we want to code in HTML5. Copy this css and save it as HTML5.css:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">header</span>, <span style="color: #800000">section</span>, <span style="color: #800000">footer</span>, <span style="color: #800000">aside</span>, <span style="color: #800000">nav</span>, <span style="color: #800000">article</span>, <span style="color: #800000">figure</span> {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">	<span style="color: #ff0000">display</span>:<span style="color: #0000ff">block</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">}</pre>
</pre>
<p>&#160;</p>
<p>The third thing you will have to do is to add some JavaScript to the beginning of your webpage to add these items to the DOM list in your browser. (Incase it isn’t supported yet)</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #008000">&lt;!--[if IE]&gt;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    &lt;script src=&quot;http://html5shiv.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">&lt;![endif]—&gt;</span>   </pre>
</pre>
<p>&#160;</p>
<p>As you can see in the example above we finally a doc type that a mortal can actually remember! Ok. Time to wrap this one up. Here’s a small FULL example of HTML5 and the CSS that goes with it:</p>
<p>HTML5 (index.html)</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span>!DOCTYPE html<span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">html</span> <span style="color: #ff0000">lang</span>=<span style="color: #0000ff">&quot;en&quot;</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">meta</span> <span style="color: #ff0000">charset</span>=<span style="color: #0000ff">&quot;utf-8&quot;</span> <span style="color: #0000ff">/&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span>HTML5 Demo<span style="color: #0000ff">&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span>=<span style="color: #0000ff">&quot;stylesheet/reset.css&quot;</span> <span style="color: #ff0000">rel</span>=<span style="color: #0000ff">&quot;stylesheet&quot;</span> <span style="color: #ff0000">type</span>=<span style="color: #0000ff">&quot;text/css&quot;</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span>=<span style="color: #0000ff">&quot;stylesheet/html5.css&quot;</span> <span style="color: #ff0000">rel</span>=<span style="color: #0000ff">&quot;stylesheet&quot;</span> <span style="color: #ff0000">type</span>=<span style="color: #0000ff">&quot;text/css&quot;</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">link</span> <span style="color: #ff0000">href</span>=<span style="color: #0000ff">&quot;stylesheet/master.css&quot;</span> <span style="color: #ff0000">rel</span>=<span style="color: #0000ff">&quot;stylesheet&quot;</span> <span style="color: #ff0000">type</span>=<span style="color: #0000ff">&quot;text/css&quot;</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #008000">&lt;!--[if IE]&gt;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    	&lt;script src=&quot;http://html5shiv.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    &lt;![endif]--&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">div</span> <span style="color: #ff0000">id</span>=<span style="color: #0000ff">&quot;page&quot;</span> <span style="color: #ff0000">class</span>=<span style="color: #0000ff">&quot;container floatmiddle&quot;</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">header</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    	<span style="color: #0000ff">&lt;</span><span style="color: #800000">h1</span><span style="color: #0000ff">&gt;</span>The title of the webpage<span style="color: #0000ff">&lt;/</span><span style="color: #800000">h1</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">header</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">nav</span> <span style="color: #ff0000">class</span>=<span style="color: #0000ff">&quot;container&quot;</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    	<span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span> <span style="color: #ff0000">class</span>=<span style="color: #0000ff">&quot;floatleft&quot;</span><span style="color: #0000ff">&gt;</span>Left<span style="color: #0000ff">&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">        <span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span> <span style="color: #ff0000">class</span>=<span style="color: #0000ff">&quot;floatright&quot;</span><span style="color: #0000ff">&gt;</span>Right<span style="color: #0000ff">&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">nav</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">section</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    	<span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>This is a test<span style="color: #0000ff">&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">section</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;</span><span style="color: #800000">footer</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    	<span style="color: #0000ff">&lt;</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>This is the footer<span style="color: #0000ff">&lt;/</span><span style="color: #800000">p</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">footer</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">div</span><span style="color: #0000ff">&gt;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&gt;</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
</pre>
<p><a href="http://jaredheinrichs.com/how-to-use-css-to-reset-the-default-browser-element-settings.html">reset.css</a>&#160; &lt;– Click here for the code</p>
<p>HTML5 – See above for the code.</p>
<p>master.css</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 615px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">body</span>    { <span style="color: #ff0000">background</span>:<span style="color: #0000ff">f4f4f4</span>; <span style="color: #ff0000">font</span>: <span style="color: #0000ff">15px/1.5 Georgia,serif</span>;}
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">a</span>       { <span style="color: #ff0000">text-decoration</span>: <span style="color: #0000ff">none</span>; }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">header</span> <span style="color: #800000">h1</span> { <span style="color: #ff0000">font</span>: <span style="color: #0000ff">bold 30px Helvetica, Sans-serif</span>; <span style="color: #ff0000">margin</span>: <span style="color: #0000ff">0 0 5px 0</span>; }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">header</span> <span style="color: #800000">h2</span> { <span style="color: #ff0000">font</span>: <span style="color: #0000ff">bold 20px Helvetica, Sans-serif</span>; <span style="color: #ff0000">margin</span>: <span style="color: #0000ff">0 0 10px 0</span>; }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px"><span style="color: #800000">#page</span> { <span style="color: #ff0000">width</span>: <span style="color: #0000ff">500px</span>; <span style="color: #ff0000">background</span>:#CCC }</pre>
</pre>
<p>&#160;</p>
<p>This will produce something that will look similar to this:</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://jaredheinrichs.com/wp-content/uploads/2010/02/image.png" width="560" height="159" /></p>
<p>I hope you found this informative <img src='http://jaredheinrichs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://jaredheinrichs.com/how-you-can-use-html5-now-even-with-older-browsers.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The difference between Block and Inline HTML elements</title>
		<link>http://jaredheinrichs.com/the-difference-between-block-and-inline-html-elements.html</link>
		<comments>http://jaredheinrichs.com/the-difference-between-block-and-inline-html-elements.html#comments</comments>
		<pubDate>Mon, 01 Feb 2010 05:15:30 +0000</pubDate>
		<dc:creator>Jared Heinrichs</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://jaredheinrichs.com/the-difference-between-block-and-inline-html-elements.html</guid>
		<description><![CDATA[I “kind of” knew what block elements were but I thought that I should research them. Searching the net I think I have found some good definitions. Basically there are 3 types of elements you can have on a page. &#8230; <a href="http://jaredheinrichs.com/the-difference-between-block-and-inline-html-elements.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I “kind of” knew what block elements were but I thought that I should research them. Searching the net I think I have found some good definitions. Basically there are 3 types of elements you can have on a page.</p>
<ol>
<li>Block </li>
<li>Inline </li>
<li>Not Displayed </li>
</ol>
<p>&#160;</p>
<h2>Block Elements</h2>
<p>A block-display element will span the full width of the space available to it, and so will start on a new line in the flow of HTML. The flow will continue on a new line after the block-display element.</p>
<p>To define an element as a block you can do it in CSS by typing:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 171px; padding-right: 5px; height: 11px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">display:block;</pre>
</pre>
<p>&#160;</p>
<p>Common HTML elements that are naturally block-display include: </p>
<ul>
<li>&lt;div&gt;</li>
<li>&lt;h1&gt; &#8230; &lt;h6&gt;</li>
<li>&lt;p&gt;</li>
<li>&lt;ul&gt;, &lt;ol&gt;, &lt;dl&gt;</li>
<li>&lt;li&gt;, &lt;dt&gt;, &lt;dd&gt;</li>
<li>&lt;table&gt;</li>
<li>&lt;blockquote&gt;</li>
<li>&lt;pre&gt;</li>
<li>&lt;form&gt;</li>
</ul>
<h2>Inline Elements</h2>
<p>Inline-display elements don&#8217;t break the flow. They just fit in with the flow of the document. </p>
<p>To define an element as an inline you can do it in CSS by typing:</p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 171px; padding-right: 5px; height: 7px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,&#39;Courier New&#39;,courier,monospace; font-size: 12px">display:inline;</pre>
</pre>
<p>&#160;</p>
<p>More elements are naturally inline-style, including: </p>
<ul>
<li>&lt;span&gt;</li>
<li>&lt;a&gt;</li>
<li>&lt;strong&gt;</li>
<li>&lt;b&gt;</li>
<li>&lt;em&gt;</li>
<li>&lt;i&gt;</li>
<li>&lt;img /&gt;</li>
<li>&lt;br&gt;</li>
<li>&lt;input&gt;</li>
<li>&lt;abbr&gt;</li>
<li>&lt;acronym&gt;</li>
</ul>
<p>Can you imagine a “&lt;a&gt;” tag being a BLOCK element? I can’t. That would suck if all links had to be on a new line all by themselves!</p>
<h2>Not Displayed</h2>
<p>Some tags, like &lt;meta /&gt; and &lt;style&gt; are not visible</p>
]]></content:encoded>
			<wfw:commentRss>http://jaredheinrichs.com/the-difference-between-block-and-inline-html-elements.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a floating two column webpage design using &#8220;div&#8221; and &#8220;css&#8221;</title>
		<link>http://jaredheinrichs.com/how-to-create-a-floating-two-column-webpage-design-using-div-and-css.html</link>
		<comments>http://jaredheinrichs.com/how-to-create-a-floating-two-column-webpage-design-using-div-and-css.html#comments</comments>
		<pubDate>Mon, 22 Jun 2009 02:49:27 +0000</pubDate>
		<dc:creator>Jared Heinrichs</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://jaredheinrichs.com/how-to-create-a-floating-two-column-webpage-design-using-div-and-css.html</guid>
		<description><![CDATA[The purpose of this post is to to show you how to make a 2 column website with a header and footer using divs and css. I also want to do it in such a way that will work in &#8230; <a href="http://jaredheinrichs.com/how-to-create-a-floating-two-column-webpage-design-using-div-and-css.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Internet Explorer Logo" border="0" alt="Internet Explorer Logo" align="left" src="http://jaredheinrichs.com/wp-content/uploads/2009/06/image39.png" width="100" height="100" /> The purpose of this post is to to show you how to make a 2 column website with a header and footer using divs and css. I also want to do it in such a way that will work in all browsers and is centered. Because IE, Firefox etc all do this differently I use one table. It is used as a container.</p>
<p>&#160;</p>
<p> <span id="more-938"></span>
<p><strong>The HTML file &lt;test.html&gt; would look like this:</strong></p>
<hr />
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">html</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">link</span> <span class="attr">href</span><span class="kwrd">=&quot;test-css.css&quot;</span> <span class="attr">rel</span><span class="kwrd">=&quot;stylesheet&quot;</span> <span class="attr">type</span><span class="kwrd">=&quot;text/css&quot;</span> <span class="kwrd">/&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>

<span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">table</span> <span class="attr">width</span><span class="kwrd">=&quot;1000&quot;</span> <span class="attr">border</span><span class="kwrd">=&quot;0&quot;</span> <span class="attr">align</span><span class="kwrd">=&quot;center&quot;</span> <span class="attr">cellpadding</span><span class="kwrd">=&quot;0&quot;</span> <span class="attr">cellspacing</span><span class="kwrd">=&quot;0&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">tr</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">td</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;main_wrapper&quot;</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;header&quot;</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>Header<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;left_column&quot;</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>This is the left Column<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;right_column&quot;</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>This is the Right Column<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;footer&quot;</span><span class="kwrd">&gt;</span>
                <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>Footer<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
            <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">td</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">tr</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">table</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>
<p>&#160;</p>
<p><strong>The CSS file &lt;teset-css.css&gt; would look like this:</strong></p>
<hr />
<pre class="csharpcode">html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,
pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,
samp,small,strike,strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,
legend,table,caption,tbody,tfoot,thead,tr,th,td
{border:0;outline:0;vertical-align:baseline;background:transparent;margin:0;padding:0;}

.main_wrapper {
    width: 1000px;
}
.header {
    width: 1000px;
    float: left;
}
.left_column {
    background-color: #999;
    width: 700px;
    float: left;
}
.right_column {
    background-color: #0F6;
    width: 300px;
    float: left;
}
.footer{
    width: 1000px;
    float: left;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://jaredheinrichs.com/how-to-create-a-floating-two-column-webpage-design-using-div-and-css.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Layout techniques</title>
		<link>http://jaredheinrichs.com/css-layout-techniques.html</link>
		<comments>http://jaredheinrichs.com/css-layout-techniques.html#comments</comments>
		<pubDate>Sat, 16 May 2009 15:19:07 +0000</pubDate>
		<dc:creator>Jared Heinrichs</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://jaredheinrichs.com/css-layout-techniques.html</guid>
		<description><![CDATA[When released, Internet Explorer 8 will support many new values for the CSS display property, including the table-related values: table, table-row, and table-cell—and it’s the last major browser to come on board with this support. This event will mark the &#8230; <a href="http://jaredheinrichs.com/css-layout-techniques.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When released, Internet Explorer 8 will support many new values for the <acronym>CSS</acronym> display property, including the table-related values: <code>table</code>, <code>table-row</code>, and <code>table-cell</code>—and it’s the last major browser to come on board with this support. This event will mark the end of complex CSS layout techniques, and will be the final nail in the coffin of using HTML tables for layout. Finally, producing table-like grid layouts using CSS will be quick and easy. </p>
<blockquote><p>Perhaps you’re feeling slightly uncomfortable about the example we’ve just seen—after all, haven’t web standards advocates like myself been insisting for years that you shouldn’t be using tables for layout?</p>
</blockquote>
<p>Applying table-related display property values to web page elements causes the elements to mimic the display characteristics of their HTML table equivalents. In this article, I’ll demonstrate how this will have a huge impact on the way we use CSS for web page layouts. </p>
<h4>Using CSS Tables</h4>
<p>CSS tables solve all the problems encountered when using absolute positioning or floats to create multi-column layouts in modern browsers. Specifying the value <code>table</code> for the <code>display</code> property of an element allows you to display the element and its descendants as though they’re table elements. The main benefit of CSS table-based layouts is the ability to easily define the boundaries of a cell so that we can add backgrounds and so on to it—without the semantic problems of marking up non-tabular content as a HTML table in the document. </p>
<p>Before we dive in and discover how this works, let’s create an instant demonstration: </p>
<pre class="csharpcode"><span class="kwrd">&lt;!</span><span class="html">DOCTYPE</span> <span class="attr">html</span> <span class="attr">PUBLIC</span> <span class="kwrd">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span>
  <span class="kwrd">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">html</span> <span class="attr">xmlns</span><span class="kwrd">=&quot;http://www.w3.org/1999/xhtml&quot;</span> <span class="attr">lang</span><span class="kwrd">=&quot;en-US&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">head</span><span class="kwrd">&gt;</span>
    ⋮ HTML head content…
  <span class="kwrd">&lt;/</span><span class="html">head</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">body</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;wrapper&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;header&quot;</span><span class="kwrd">&gt;&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;main&quot;</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;nav&quot;</span><span class="kwrd">&gt;</span>
          ⋮ navigation column content…
        <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;extras&quot;</span><span class="kwrd">&gt;</span>
          ⋮ news headlines column content…
        <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;content&quot;</span><span class="kwrd">&gt;</span>
          ⋮ main article content…
        <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">body</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">html</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The HTML source matches the desired content display order. The nav column comes first, followed by the extras column, and then the content column. </p>
<p>We also need to apply the following CSS: </p>
<pre class="csharpcode">#main {
  display: table;
  border-collapse: collapse;
}

#nav {
  display: table-cell;
  width: 180px;
  background-color: #e7dbcd;
}

#extras {
  display: table-cell;
  width: 180px;
  padding-left: 10px;
  border-right: 1px dotted #d7ad7b;
}

#content {
  display: table-cell;
  width: 380px;
  padding-left: 10px;
} </pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The fresh CSS table-based layout that we’ve just created will display correctly in Internet Explorer 8 as well as in Firefox, Safari, and Opera; the image below shows how it looks in IE8. </p>
<p><img alt="" src="http://www.digital-web.com/extras/css_wrong/1.png" /></p>
<p>Our three-column equal-height layout is achieved without having to resort to tricks like faux columns using background images, worrying about positioning, or having to clear floats—revolutionary! </p>
<h4>How Does This Work?</h4>
<p>The <code>display</code> property allows you to specify a range of table-related values in order to make elements display as though they were table elements. The available display values are: </p>
<ul>
<li><code>table</code> makes the element behave like a table element </li>
<li><code>table-row</code> makes the element behave like a table row (tr) element </li>
<li><code>table-cell</code> makes the element behave like a table cell (td) element </li>
<li><code>table-row-group</code> makes the element behave like a table body row group (tbody) element </li>
<li><code>table-header-group</code> makes the element behave like a table header row group (thead) element </li>
<li><code>table-footer-group</code> makes the element behave like a table footer row group (tfoot) element </li>
<li><code>table-caption</code> makes the element behave like a table caption element </li>
<li><code>table-column</code> makes the element behave like a table column (col) element </li>
<li><code>table-column-group</code> makes the element behave like a table column group (colgroup) element </li>
</ul>
<h5>Hang on… Aren’t Tables for Layout Wrong?</h5>
<p>Perhaps you’re feeling slightly uncomfortable about the example we’ve just seen—after all, haven’t web standards advocates like myself been insisting for years that you shouldn’t be using tables for layout?</p>
<p>The <code>table</code> element in HTML is a semantic structure: it describes what data is. Therefore, you should only use the <code>table</code> element if the data you are marking up is tabular—for example, a table of financial information. If it would normally be stored in a spreadsheet on your computer, it probably needs marking up as a table in HTML. </p>
<p>The <code>table</code> value of the <code>display</code> property, on the other hand, is simply an indi­cation of how something should look in the browser—it has no semantic meaning. Using a <code>table</code> element for your layout tells a user-agent, “This data is tabular.” Using a bunch of <code>div</code>s that have the <code>display</code> property set to <code>table</code> and <code>table-cell</code> says nothing to that user-agent other than asking it to render them visually in a certain way, if it’s capable of doing so. </p>
<p>Of course, we should also take care not to use <code>display: table;</code> on a bunch of <code>div</code> elements when what we really have is tabular data! </p>
<p>Our simple example above makes our layout behave as if it were a single row table with three cells; it doesn’t take much imagination to realize the potential of this technique for creating complex grid layouts with ease. </p>
<h4>Anonymous Table Elements</h4>
<p>CSS tables happily abide by the normal rules of table layout, which enables an ex­tremely powerful feature of CSS table layouts: missing table elements are created anonymously by the browser. The CSS2.1 specification states: </p>
<blockquote>
<p>Document languages other than HTML may not contain all the ele­ments in the CSS 2.1 table model. In these cases, the “missing” elements must be assumed in order for the table model to work. Any table element will automatically generate necessary anonymous table objects around itself, consisting of at least three nested objects corresponding to a “table”/“inline-table” element, a “table-row” element, and a “table-cell” element. </p>
</blockquote>
<p>What this means is that if we use <code>display: table-cell;</code> without first containing the cell in a block set to <code>display: table-row;</code>, the row will be implied—the browser will act as though the declared row is actually there. </p>
<p>Let’s use a simple example to investigate this feature: the three-cell grid layout shown below. We’ll look at three different HTML markup samples that will result in the same visual layout. </p>
<p><img alt="" src="http://www.digital-web.com/extras/css_wrong/2.png" /></p>
<p>First, here’s a sample of markup that can be used to generate the three-cell layout: </p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;container&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;row&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL A<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL B<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL C<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>A set of nested <code>div</code> elements may not seem so very exciting, but hang in there, we’re building to something. The CSS is also very simple: </p>
<pre class="csharpcode">.container {
  display: table;
}

.row {
  display: table-row;
}

.cell {
  display: table-cell;
  width: 100px;
  height: 100px;
  border: 1px solid blue;
  padding: 1em;
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The CSS above sets the element with a class of ‘container’ to <code>display: table</code>, an element with a class of ‘row’ to <code>display: table-row</code>, and an element with a class of ‘cell’ to <code>display: table-cell</code>, as well as giving it a border and a height and width. </p>
<p>This HTML markup above explicitly creates elements for the table and row surroun­ding the three cells, using all of the CSS classes that we’ve created. However, we can reduce the markup, removing the row div element like so: </p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;row&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL A<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL B<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL C<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Even though the above markup is missing the element representing the table row, the row will be created by the browser as an anonymous box. We can reduce the markup even further: </p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL A<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL B<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL C<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The above markup is missing the elements representing the table row and the table; these are both created as anonymous boxes by the browser. Even with the elements missing in markup, the end product is the same. </p>
<h5>Rules for the Creation of Anonymous Table Elements</h5>
<p>These anonymous boxes are not created by magic, and they won’t automatically make up for any deficiencies in your HTML code. To be able to take full advantage of anonymous table elements, you’d best become familiar with the rules for their creation. If a layout calls for an implied element, the browser will create an anony­mous box and set its CSS display property to one of <code>table</code>, <code>table-row</code>, or <code>table-cell</code>, depending on the context. </p>
<p>If you have an element that has been set to <code>display: table-cell;</code> but its immediate parent (the containing element) is not set to <code>table-row</code>, an anonymous box set to <code>table-row</code> will be created to enclose the cell and any subsequent adjacent sibling elements that are also set to <code>table-cell</code>, until it encounters an element not set to <code>table-cell</code>, so they’ll all end up in the same row. This is the case with the following markup: </p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL A<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL B<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;cell&quot;</span><span class="kwrd">&gt;</span>CELL C<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span><span class="kwrd">&gt;</span>Not a cell<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The three <code>div</code> elements above that have a class of ‘cell’ are set to <code>display: table-cell;</code> and will appear side by side as though they’re in a single row table; the last <code>div</code> element won’t be included in the row, because it isn’t set to <code>display: table-cell;</code>. </p>
<p>If an element is set to <code>display: table-row;</code> while its parent element isn’t set to <code>table</code> (or <code>table-row-group</code>), an anonymous box set to <code>display: table;</code> will be created to enclose the row, and any subsequent adjacent sibling elements will be set to <code>display: table-row</code>. Also, if the element with display set to <code>table-row</code> lacks an element set to <code>table-cell</code> directly within it, an anonymous box set to <code>table-cell</code> will be created to enclose all the elements within the <code>table-row</code> element. </p>
<p>Consider the following markup: </p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;row&quot;</span><span class="kwrd">&gt;</span>ROW A<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;row&quot;</span><span class="kwrd">&gt;</span>ROW B<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span><span class="kwrd">&gt;</span>Not a row<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The two <code>div</code> elements above with a class of ‘row’ are set to <code>display: table-row;</code> and will appear one under the other as though they’re rows in the same single-column table. The last <code>div</code> element won’t be included in the implied table. </p>
<p>Similarly, if an element is set to any of the other display values that match elements which would naturally exist directly inside a parent table element such as <code>table-row-group</code>, <code>table-header-group</code>, <code>table-footer-group</code>, <code>table-column</code>, <code>table-column-group</code>, and <code>table-caption</code>, but does not have a parent set to <code>display: table;</code>, an anonymous box set to <code>table</code> will be created to enclose the element and any subsequent adjacent sibling elements with suitable display values. </p>
<h4>Other Useful Table Properties</h4>
<p>When using CSS tables, because the elements conform to the normal rules for table layout, you can also apply other table-related CSS properties. Here’s a few that can come in handy: </p>
<h5>table-layout</h5>
<p>Setting the <code>table-layout</code> to <code>fixed</code> tells the browser that the table should render with the fixed algorithm for formatting the cell widths. This is useful in a fixed-width layout, such as the one we created earlier. </p>
<h5>border-collapse</h5>
<p>Just as with regular HTML tables, you can use the <code>border-collapse</code> property to specify that your table layout elements use collapsed (with the value <code>collapse</code>) or separated (with the value <code>separate</code>) borders between the cell elements. </p>
<h5>border-spacing</h5>
<p>If you specify the value <code>separate</code> for the <code>border-collapse</code> property, you can then use the <code>border-spacing</code> property to specify the width of the space between the cell element borders. </p>
<h4>Making a Perfect Grid</h4>
<p>Making a grid of equal height elements has always been a challenge using traditional CSS layout techniques, but it’s something to which CSS tables are well suited. For example, if we want to create an image gallery comprising a grid of images with captions, such as the one shown below, using a CSS table renders the task simple. </p>
<p><img alt="" src="http://www.digital-web.com/extras/css_wrong/3.png" /></p>
<p>The markup for our gallery is as follows: </p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;grid&quot;</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;row&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;image&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">src</span><span class="kwrd">=&quot;images/photo1.jpg&quot;</span> <span class="attr">alt</span><span class="kwrd">=&quot;A Lily&quot;</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>A lily in the gardens of The Vyne Country House<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;image&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">src</span><span class="kwrd">=&quot;images/photo3.jpg&quot;</span> <span class="attr">alt</span><span class="kwrd">=&quot;A Fuchsia plant&quot;</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>Fuchsia plant in my garden<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;row&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;image&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">src</span><span class="kwrd">=&quot;images/photo2.jpg&quot;</span> <span class="attr">alt</span><span class="kwrd">=&quot;A crazy looking Allium flower&quot;</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>A crazy looking flower<span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">=&quot;image&quot;</span><span class="kwrd">&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">img</span> <span class="attr">src</span><span class="kwrd">=&quot;images/photo4.jpg&quot;</span> <span class="attr">alt</span><span class="kwrd">=&quot;A Robin sitting on a fence&quot;</span> <span class="kwrd">/&gt;</span>
      <span class="kwrd">&lt;</span><span class="html">p</span><span class="kwrd">&gt;</span>
        This robin has been visiting our garden over the summer.
        He is very friendly and doesn't seem to be too worried about sharing the garden with us.
      <span class="kwrd">&lt;/</span><span class="html">p</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>Each gallery image cell is comprised of an <code>img</code> element and a caption in a <code>p</code> element contained within a <code>div</code> element with a class of ‘image’. Each row is contained within a <code>div</code> element within a class of ‘row’, and the whole gallery is contained within a <code>div</code> with a class of ‘grid’. </p>
<p>The CSS required to lay out our grid is simple: </p>
<pre class="csharpcode">.grid {
  display: table;
  border-spacing: 4px;
}
.row {
  display: table-row;
}
.image {
  display: table-cell;
  width: 240px;
  background-color: #000;
  border: 8px solid #000;
  vertical-align: top;
  text-align: center;
}
.image p {
  color: #fff;
  font-size: 85%;
  text-align: left;
  padding-top: 8px;
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<p>The above CSS is fairly straightforward, but you might notice how we’ve made use of the <code>border-spacing</code> property to control the spacing of our gallery image cells. Making a grid layout couldn’t be easier—and we’ve avoided any headaches over equal heights or fragile layouts made with floated elements. </p>
<h4>Putting Principles into Practice</h4>
<p>This article has presented a basic primer to the usage of the table-related values of the CSS <code>display</code> property—finally, a source of relief for all those struggling to construct reliable grid-based layouts using CSS! We had an introduction to the straightforward approach to layout provided by CSS tables. We explored the various table-related display values available, looked at the nature of anonymous table elements, and discovered some other useful CSS table properties. </p>
<p>The next step is up to you—with any luck, you have realized the potential CSS tables provide for creating grid layouts, and are now bursting with curiosity! Using the knowledge gained in this article, you’re all set up to begin experimenting with your own CSS table layouts and create new techniques. </p>
]]></content:encoded>
			<wfw:commentRss>http://jaredheinrichs.com/css-layout-techniques.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

