<?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>CSS Tutorial &#187; Killer CSS Tips and Tricks</title>
	<atom:link href="http://www.csstutorial.net/category/killer-css-tips-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csstutorial.net</link>
	<description>CSS Tutorial</description>
	<lastBuildDate>Thu, 09 Sep 2010 17:06:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Centering Text with CSS</title>
		<link>http://www.csstutorial.net/2010/06/centering-text-with-css/</link>
		<comments>http://www.csstutorial.net/2010/06/centering-text-with-css/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 00:29:25 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Misc]]></category>
		<category><![CDATA[CSS Page Layouts]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[centering text]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=881</guid>
		<description><![CDATA[Centering text and other elements can easily be done with the CSS text-align property. It can be applied to a division, the p tag - pretty much any block-level element.]]></description>
			<content:encoded><![CDATA[<p>Centering text and other elements can easily be done with the CSS text-align property. It can be applied to a division, the p tag &#8211; pretty much any block-level element.</p>
<p>Applying this to an internal or external stylesheet:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>or this to inline styling:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;p style=&quot;text-align: center;&quot;&gt;This is centered text&lt;/p&gt;</pre></div></div>

<p style="text-align: center;">will center your text.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/06/centering-text-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The CSS Overflow Property</title>
		<link>http://www.csstutorial.net/2010/06/the-css-overflow-property/</link>
		<comments>http://www.csstutorial.net/2010/06/the-css-overflow-property/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 13:07:27 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Misc]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[overflow]]></category>
		<category><![CDATA[overflow auto]]></category>
		<category><![CDATA[overflow hidden]]></category>
		<category><![CDATA[overflow visible]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=833</guid>
		<description><![CDATA[By default, elements in a website will expand to make room for whatever they contain. An empty division, for example, won't show at all, but you can add 1 or 12 (whatever) paragraphs, and the division will be as big as it needs to be so everything inside is displayed.]]></description>
			<content:encoded><![CDATA[<p>By default, elements in a website will expand to make room for whatever they contain. An empty division, for example, won&#8217;t show at all, but you can add 1 or 12 (whatever) paragraphs, and the division will be as big as it needs to be so everything inside is displayed.</p>
<p>But what happens if the dimensions of an element &#8211; let&#8217;s use a division for this demonstration &#8211; are set?</p>
<div style="width: 200px; height: 100px; background: #ededed;">
<p>This division is set at a height and width of 100 and 200 pixel, respectively, and it has a colored background to display its dimension.</p>
</div>
<p>The code that creates this looks like this:</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;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width: 200px; height: 100px; background: #ededed;&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>This division is set at a height and width of 100 and 200 pixel,
respectively, and it has a colored background to display its dimension.
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>In this example, overflow is no issue, there is nothing here to overflow.  But what happens, if I add more content than this little box can hold?</p>
<div style="width: 200px; height: 100px; background: #ededed;">
<p>Es war einmal ein kleines süßes Mädchen, das hatte jedermann lieb, der es nur ansah, am allerliebsten aber ihre Großmutter, die wußte gar nicht, was sie alles dem Kinde geben sollte. Einmal schenkte sie ihm ein Käppchen von rotem Sammet, und weil ihm das so wohl stand und es nichts anders mehr tragen wollte, hieß es nur das Rotkäppchen.</p>
</div>
<p>My cup overfloweth! And this is where the overflow property comes into play.  As you see, there is no overflow property applied to the above.</p>
<p>My cup overfloweth! And this is where the overflow property comes into play.  As you see, there is no overflow property applied to the above.</p>
<p>My cup overfloweth! And this is where the overflow property comes into play.  As you see, there is no overflow property applied to the above.</p>
<p>Geesh, I had to say that three times just to clear my overflow so one can actually read what is written.  But it makes the point nicely &#8211; If you stick more content into a container than it can hold, you have a problem!</p>
<p>This is where the overflow property comes into play. As you see, there is no overflow property applied to the above, but the division is responding to the default, which is</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>So I need to decide what to do with this overflow.  One option is to hide it by applying &#8216;overflow: hidden&#8217; to the CSS.  In an internal or external stylesheet, the styling for our example division would then look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">div {
height: 100px;
width: 200px;
background: #EDEDED;
overflow: hidden;
}</pre></div></div>

<p>And as we look at the result of this, it&#8217;s easy to realize what kind of problem we now have:</p>
<div style="width: 200px; height: 100px; background: #ededed; overflow: hidden;">
<p>Es war einmal ein kleines süßes Mädchen, das hatte jedermann lieb, der es nur ansah,  am allerliebsten aber ihre Großmutter, die wußte gar nicht, was sie alles dem Kinde geben sollte. Einmal schenkte sie ihm ein Käppchen von rotem Sammet, und weil ihm das so wohl stand und es nichts anders mehr tragen wollte, hieß es nur das Rotkäppchen.</p>
</div>
<p>Obviously, this creates a whole new issue:  Now, part of the text has disappeared, and unless folks look at the source &#8211; and who, with the exception of us geeks, would do that??? &#8211; they will never know what else you had to say.</p>
<p>Good news is that in addition to &#8216;visible&#8217; and &#8216;hidden&#8217;, which we explored above, there are two additional values to chose from: &#8217;scroll&#8217; and &#8216;auto&#8217;. &#8216;Scroll&#8217; will create a horizontal AND a vertical scrollbar to the box, whether one is needed or not.</p>
<div style="width: 200px; height: 100px; background: #ededed; overflow: scroll;">
<p>This division is set at a height and width of 100 and 200 pixel, respectively.</p>
</div>
<p>That doesn&#8217;t make much sense. Why put a scrollbar if there&#8217;s nothing to scroll to? But if you think that you would know, as you design your site, if your content will fit into its element or not, you are not 100% correct.  Things may or may not fit when YOU look at them, but you can never be sure exactly how all the folks visiting have their settings adjusted and how things look to them.  With that in mind </p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>is the perfect solution.  A srollbar will appear if one is needed:</p>
<div style="width: 200px; height: 100px; background: #ededed; overflow: auto;">
<p>Es war einmal ein kleines süßes Mädchen, das hatte jedermann lieb, der es nur ansah, am allerliebsten aber ihre Großmutter, die wußte gar nicht, was sie alles dem Kinde geben sollte. Einmal schenkte sie ihm ein Käppchen von rotem Sammet, und weil ihm das so wohl stand und es nichts anders mehr tragen wollte, hieß es nur das Rotkäppchen.</p>
</div>
<p>And not, if it&#8217;s not needed:</p>
<div style="width: 200px; height: 100px; background: #ededed; overflow: auto;">
<p>This division is set at a height and width of 100 and 200 pixel, respectively.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/06/the-css-overflow-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling a Horizontal Rule with CSS</title>
		<link>http://www.csstutorial.net/2010/06/styling-a-horizontal-rule-with-css/</link>
		<comments>http://www.csstutorial.net/2010/06/styling-a-horizontal-rule-with-css/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 13:05:08 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Misc]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[horizontal rule]]></category>
		<category><![CDATA[hr]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=821</guid>
		<description><![CDATA[A quick and easy way to insert a dividing line into a website is with a horizontal rule, the hr tag.]]></description>
			<content:encoded><![CDATA[<p>A quick and easy way to insert a dividing line into a website is with a horizontal rule, the hr tag.</p>
<p>This horizontal rule</p>
<hr style="color: #f00; background: #f00; width: 75%; height: 5px;">
<p>was created by the following inline CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;hr style<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;color: #f00; background: #f00; width: 75%; height: 5px;&quot;</span><span style="color: #00AA00;">&gt;</span></pre></div></div>

<p>It could also be styled in your internal or external stylesheet (which is usually the better approach):</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">hr <span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f00</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f00</span><span style="color: #00AA00;">;</span> 
     <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">75</span>%</span><span style="color: #00AA00;">;</span> 
     <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Note that color AND background-color are applied.  This is necessary, as some browsers use the background-color, others (IE) the color element to apply color to the rule.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/06/styling-a-horizontal-rule-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the CSS z-index</title>
		<link>http://www.csstutorial.net/2010/06/using-the-css-z-index/</link>
		<comments>http://www.csstutorial.net/2010/06/using-the-css-z-index/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 15:07:00 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Page Layouts]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[stacking order of elements]]></category>
		<category><![CDATA[z-index]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=799</guid>
		<description><![CDATA[By default, the elements of a website line themselves up next to or under each other automatically. However, at times, the design requires them to overlap.  When that happens, the stacking order becomes important, and the natural stacking order will need to be manipulated.]]></description>
			<content:encoded><![CDATA[<p>By default, the elements of a website line themselves up next to or under each other automatically. However, at times, the design requires them to overlap.  When that happens, the stacking order becomes important, and the natural stacking order will need to be manipulated.</p>
<p>Without applying any CSS to the elements within the wrapper on the demo page here, this code:</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;">body</span>&gt;</span>
<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;wrapper&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;aqua&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;aqua.gif&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;aqua square&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;green&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;green.gif&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;green square&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>The z-index and CSS -- When the Stacking Order Matters<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>All elements appear in their natural order as they are entered in the HTML<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
<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: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></pre></div></div>

<p>creates a page that looks <a href='http://www.csstutorial.net/wp-content/uploads/2010/06/z-index01.html'>like this</a>. As you see, there is no point worrying about stacking order, the elements aline themselves automatically.</p>
<p>However, when positioning is applied and they start overlapping, we can change their stacking order if we need to. When it comes to z-index and the stacking order, one must note the following:</p>
<ol>
<li>Z-index only works on relative or absolute positioned elements</li>
<li>The default z-index is zero</li>
</ol>
<p><a href='http://www.csstutorial.net/wp-content/uploads/2010/06/z-index02.html'>Here</a>, I have added an absolute position to the h1 and a relative position to the green box to move them up and down-and-left, respectively.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#green</span> <span style="color: #00AA00;">&#123;</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: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-50px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
h2 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span> <span style="color: #808080; font-style: italic;">/*This is here to push the line below the green box */</span></pre></div></div>

<p>That means that the aqua image, which does NOT have positioning applied, sits on the default level of zero.  Adding any kind of z-index to the element is useless &#8211; it won&#8217;t budge because of the lacking positioning.  But we can move the text and the box either under (with a negative z-index) or on top (with a positive z-index) the not-positioned, zero-level aqua box.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#green</span> <span style="color: #00AA00;">&#123;</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: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> -<span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>creates <a href='http://www.csstutorial.net/wp-content/uploads/2010/06/z-index03.html'>this page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/06/using-the-css-z-index/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling iframes with CSS</title>
		<link>http://www.csstutorial.net/2010/06/styling-iframes-with-css/</link>
		<comments>http://www.csstutorial.net/2010/06/styling-iframes-with-css/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 19:23:41 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Misc]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=746</guid>
		<description><![CDATA[If you still haven't heard, hear it now:  <strong>FRAMES ARE DEAD</strong> - well, technically, they are more like the undead - the zombies of webdesign.  They should be gone and forgotten but refuse to stay buried.  It's much better not to use them. However, there may be a situation, where inserting a separate html document into your page makes sense.]]></description>
			<content:encoded><![CDATA[<p>If you still haven&#8217;t heard, hear it now:  <strong>FRAMES ARE DEAD</strong> &#8211; well, technically, they are more like the undead &#8211; the zombies of webdesign.  They should be gone and forgotten but refuse to stay buried.  It&#8217;s much better not to use them.</p>
<p>However, there may be a situation, where inserting a separate html document into your page makes sense. And there&#8217;s an app for that:  <strong>Iframes</strong> (aka inline frames).  This code inserts a basic page into an html page:</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;">iframe</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.killersites.com/&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Your browser does not support iframes.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">iframe</span>&gt;</span></pre></div></div>

<p>At this point, there is absolutely no styling applied to the iframe, and it looks <a href='http://www.csstutorial.net/wp-content/uploads/2010/06/iframes01.html'>like this</a>. Note the line regarding lack of browser support. Iframes are supported by all the major browsers, but it&#8217;s a good idea to add this for the odd browser that doesn&#8217;t.</p>
<p>While I am a strong supporter of using the HTML strict doctype and writing validating, standard-compliant code &#8211; iframes will not validate, which leaves us with two options:  Either suck up the iframe-related validation errors or switch to HTML transitional doctype for the pages with iframes.</p>
<p>CSS gives you the power to dress your iframe up a bit. The following attributes are available:</p>
<ul>
<li>src (the URL of your iframe)</li>
<li>longdesc (this specifies the URL of the iframe, but is hardly supported and can just as well be ignored)</li>
<li>name (obviously, the name of your iframe)</li>
<li>height (the height of your iframe)</li>
<li>width (the width of your iframe)</li>
<li>frameborder (1 or 0 &#8211; 1 is for yes, 0 for no)</li>
<li>marginheight (determines the top and bottom margin of your iframe)</li>
<li>marginwidth (determines right and left margins of your iframe</li>
<li>scrolling (Do you want a scrollbar? Yes, no, or auto &#8211; &#8216;Yes&#8217;, is obvious. &#8216;No&#8217; should not be used &#8211; what if someone does not see the entire content?  If this is set to &#8216;no&#8217;, that viewer can never get to the hidden parts of what you&#8217;re inserting. &#8216;Auto&#8217; lets the browser decide if one is needed and seems the best option here to me.)</li>
<li>(align) &#8211; I&#8217;m just mentioning this for completeness; it has been deprecated.  Don&#8217;t use it.</li>
</ul>
<p>So this inline CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">&lt;iframe src<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;http://www.killersites.com&quot;</span> 
name<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;Killersites.com&quot;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;400px&quot;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;700px&quot;</span> 
frameborder<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> marginheight<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> marginwidth<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;35&quot;</span> 
scrolling<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;auto&quot;</span><span style="color: #00AA00;">&gt;</span>
&lt;p<span style="color: #00AA00;">&gt;</span>Your browser does not support iframes.&lt;/p<span style="color: #00AA00;">&gt;</span>
&lt;/iframe<span style="color: #00AA00;">&gt;</span></pre></div></div>

<p><a href='http://www.csstutorial.net/wp-content/uploads/2010/06/iframes02.html'>Gives you that</a>. And if you add a bit more CSS to the frame itself:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">iframe <span style="color: #00AA00;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">95px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><a href='http://www.csstutorial.net/wp-content/uploads/2010/06/iframes03.html'>you can position the entire frame where you want it</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/06/styling-iframes-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>All Caps with CSS</title>
		<link>http://www.csstutorial.net/2010/05/changing-the-font-to-all-caps-with-css/</link>
		<comments>http://www.csstutorial.net/2010/05/changing-the-font-to-all-caps-with-css/#comments</comments>
		<pubDate>Tue, 11 May 2010 10:40:49 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Fonts]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[all caps]]></category>
		<category><![CDATA[capital letters]]></category>
		<category><![CDATA[uppercase fonts]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=698</guid>
		<description><![CDATA[While text in general is hard to read when written in all caps - and considered the electronic version of yelling - using CAPS for emphasize is a handy tool. Headers are a place where capitalization is frequently used.  And to assure that your header is displayed uniformly throughout the site without having to worry about actually writing in all caps, just use CSS.]]></description>
			<content:encoded><![CDATA[<p>While text in general is hard to read when written in all caps &#8211; and considered the electronic version of yelling &#8211; using CAPS for emphasize is a handy tool.</p>
<p>Headers are a place where capitalization is frequently used.  And to assure that your header is displayed uniformly throughout the site without having to worry about actually writing in all caps, just use CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">h1 <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>With this, everything that has the h1 tag applied, <span style="text-transform: uppercase;">will appear in all caps</span>.</p>
<p>Another interesting text-transformation property is &quot;capitalize&quot;</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">h1 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">capitalize</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p style="text-transform: capitalize;">With this, all your words will begin with a capital letter!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/05/changing-the-font-to-all-caps-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple Background Images with CSS</title>
		<link>http://www.csstutorial.net/2010/05/multiple-background-images-with-css/</link>
		<comments>http://www.csstutorial.net/2010/05/multiple-background-images-with-css/#comments</comments>
		<pubDate>Sat, 08 May 2010 11:48:48 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Misc]]></category>
		<category><![CDATA[CSS Page Layouts]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[multiple background images]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=655</guid>
		<description><![CDATA[At times, it makes more sense to use background images than to insert them directly into the page.  And while each element - like your body tag - can hold only one background image, they can be applied to several elements.]]></description>
			<content:encoded><![CDATA[<p>At times, it makes more sense to use background images than to insert them directly into the page.  And while each element &#8211; like your body tag &#8211; can hold only one background image, they can be applied to several elements.</p>
<p>But pretty much every selector can hold a background image.  On <a href='http://www.csstutorial.net/wp-content/uploads/2010/05/multiple-background-images.html'>THIS PAGE</a>, I have added the image to the html tag, the body tag, and the h1 and h2 tags (these are &#8217;selectors&#8217;) &#8211; like so:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">bgimage.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">repeat-y</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
html <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">bgimage.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">repeat-y</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">bgimage.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
h2 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">bgimage.jpg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #cc00cc;">#ffc</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">250px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">250px</span><span style="color: #00AA00;">;</span> 
<span style="color: #808080; font-style: italic;">/*I'm using the right and left padding of the wrapper to keep
the content off the images */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Note that I&#8217;m a bit lazy at the moment, and am using the same image for all four selectors.  Taking a closer look at each of them, also shows a bit more how things work:</p>
<p>The html tag (image displayed on the left) repeats the flower all the way down the monitor, regardless of how much content there is.  Resize your window and see what happens.</p>
<p>The body tag, where the image is displayed to the right, only shows the image as far as the content goes.</p>
<p>The h1 tag only shows as much of the image as the space its content is taking up.</p>
<p>The h2 tag also has some height added to it (exactly 150px, the height of the background image), so it does show the entire image.  I&#8217;ve also added the background color to more clearly demonstrate the space that&#8217;s taken up by h2.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/05/multiple-background-images-with-css/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Styling Lists with CSS</title>
		<link>http://www.csstutorial.net/2010/04/styling-lists-with-css/</link>
		<comments>http://www.csstutorial.net/2010/04/styling-lists-with-css/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 23:50:03 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Misc]]></category>
		<category><![CDATA[CSS Page Layouts]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[ordered lists]]></category>
		<category><![CDATA[styling list items]]></category>
		<category><![CDATA[unordered lists]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=659</guid>
		<description><![CDATA[We've already discussed navigation lists and list bullet images, but sometimes, a list is just a list. There are two types - the ordered list and the unordered list. The ordered list counts the items; the unordered list marks the individual items with bullets or other markers. The HTML is simple.]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve already discussed navigation lists and list bullet images, but sometimes, a list is just a list. There are two types &#8211; the ordered list and the unordered list. The ordered list counts the items; the unordered list marks the individual items with bullets or other markers. The HTML is simple.</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;">ol</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ol</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;</span>List Item<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div>

<p>And, without any styling applied at all, that looks <a href='http://www.csstutorial.net/wp-content/uploads/2010/04/lists01.html'>Like This</a>.</p>
<p>We can affect the list item markers with some simple CSS and the list-style-property controls those.  For unordered lists, we can chose between ul styles: disc, square, circle, or none  &#8211; <a href='http://www.csstutorial.net/wp-content/uploads/2010/04/lists02.html'>which looks like this</a>, or between ol styles: decimal, decimal-leading-zero, lower-roman, upper-roman, lower-alpha, upper-alpha, lower-greek, upper-greek, lower-latin, upper-latin, armenian, or georgian, <a href='http://www.csstutorial.net/wp-content/uploads/2010/04/lists03.html'>which looks like that</a>.</p>
<p>Other than that, we can style the ul tag and the li tag.  Anything added to the ul tag, affects the entire list, where properties applied to the li tag will affect the individual list items. So this CSS</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">ul <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffe566</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
ol <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#828772</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
ul li <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fc6</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
ol li <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#9cc</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">35px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><a href='http://www.csstutorial.net/wp-content/uploads/2010/04/lists04.html'>will create that</a>.</p>
<p>(Note that I had to add the &#8216;ul&#8217; or &#8216;ol&#8217; in front of the &#8216;li&#8217; so I could target specifically either list&#8217;s items.  Had I just used &#8216;li&#8217;, any styling would have affected all of them regardless.) &hellip; <a href='http://www.csstutorial.net/wp-content/uploads/2010/04/lists05.html'>example: adding a larger font size to &#8216;just li&#8217;</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/04/styling-lists-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image Borders with CSS</title>
		<link>http://www.csstutorial.net/2010/04/how-to-add-borders-to-images-with-css/</link>
		<comments>http://www.csstutorial.net/2010/04/how-to-add-borders-to-images-with-css/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 21:22:55 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Misc]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[image border with CSS]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=638</guid>
		<description><![CDATA[Sometimes, a website design benefits when images have frames - or borders.  One way to get them is one image at a time, using a graphics program.  But there is a much faster way - with CSS!]]></description>
			<content:encoded><![CDATA[<p>Sometimes, a website design benefits when images have frames &#8211; or borders.  One way to get them is one image at a time, using a graphics program.  But there is a much faster way &#8211; with CSS!</p>
<p>This code:</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;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;image.jpg&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;350px&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;262px&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Rusty Stove in Luckenbach, Texas&quot;</span>&gt;</span></pre></div></div>

<p>inserts a plain image into your page:</p>
<p><img src="http://www.csstutorial.net/wp-content/uploads/2010/04/luckenbach.jpg" alt="" title="Rusty Stove in Luckenbach, Texas - with chicken" width="350" height="262" class="aligncenter size-full wp-image-640" />
<p>And if we add this to our CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">img <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#7d6b72</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Then our image appears like this:</p>
<p><img style="border: solid 5px #7d6b72;" src="http://www.csstutorial.net/wp-content/uploads/2010/04/luckenbach.jpg" alt="" title="Rusty Stove in Luckenbach, Texas - with chicken" width="350" height="262" class="aligncenter size-full wp-image-640" />
<p>Actually, I would use shortcuts and write my CSS like this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">img <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#7d6b72</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/04/how-to-add-borders-to-images-with-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>3-Column, Fixed Width Layout with CSS</title>
		<link>http://www.csstutorial.net/2010/04/3-column-layout/</link>
		<comments>http://www.csstutorial.net/2010/04/3-column-layout/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 00:06:35 +0000</pubDate>
		<dc:creator>Andrea Barnett</dc:creator>
				<category><![CDATA[CSS Basics]]></category>
		<category><![CDATA[CSS Page Layouts]]></category>
		<category><![CDATA[Killer CSS Tips and Tricks]]></category>
		<category><![CDATA[3-column layout]]></category>

		<guid isPermaLink="false">http://www.csstutorial.net/?p=602</guid>
		<description><![CDATA[The three-column layout is probably the second most common layout used for websites.  There's usually a header and a footer - and then some content, maybe a sidebar for navigation, a column in the middle with some content info, and another column with some additional stuff, whatever that may be.  What you put inside your columns doesn't matter - the way to achieve the 3-column layout stays the same.]]></description>
			<content:encoded><![CDATA[<p>The three-column layout is probably the second most common layout used for websites.  There&#8217;s usually a header and a footer &#8211; and then some content, maybe a sidebar for navigation, a column in the middle with some content info, and another column with some additional stuff, whatever that may be.  What you put inside your columns doesn&#8217;t matter &#8211; the way to achieve the 3-column layout stays the same.</p>
<p>So let&#8217;s start with our basic HTML to put all the parts on paper &#8212; or in our case, on line.  This is the basic outline of what&#8217;s between the body tags:</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;wrapper&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;&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;column-left&quot;</span>&gt;&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;column-center&quot;</span>&gt;&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;column-right&quot;</span>&gt;&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;&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>For the entire HTML code &#8211; to include some filler content &#8211; see <a href='http://www.csstutorial.net/wp-content/uploads/2010/04/3-column01.html'>Basic HTML &#8211; No Styling</a>.  To see the code of the example page, just right-click and chose &#8220;View Source&#8221; from the drop-down.  Most browsers offer that feature.</p>
<p>And of course what we get, is NOT a 3-column layout.  It&#8217;s just one division on top of the next.  That&#8217;s because we haven&#8217;t gotten to the &#8216;with CSS&#8217; part of the title of this post yet.  So let&#8217;s already!!</p>
<p>First, and just to make things easier to see, I will apply the fixed width and center my page.  Here&#8217;s a post with the finer details <a href="http://www.csstutorial.net/2010/02/how-to-create-a-center-aligned-page-with-css/">Center-aligning a Website</a> right here already.  Here is the CSS that does that:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">980px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">silver</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#header</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#column-left</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#column-center</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#column-right</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">purple</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>(Please note that you should really be using hex or rbg color codes, but for the purpose of this demonstration, color names are just easier to deal with.)</p>
<p>And it looks <a href='http://www.csstutorial.net/wp-content/uploads/2010/04/3-column02.html'>Like This</a>.  Now we just have to get our columns to act like columns and line up next to each other.  There are different ways to do this, but I prefer to just float them all.  So we&#8217;ll give them all a width and add <strong>float: left;</strong> to our three columns:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#column-left</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">250px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#column-center</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">480px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#column-right</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">250px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">purple</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>At this point, it&#8217;s important to be aware of a special characteristic of floats &#8211; I picture them as balloons &#8211; they float above our heads, without taking up any actual space among us.  So just as you can place a box under a balloon without the two affecting each other&#8217;s space, our footer will act like the floated divisions are not even there, and line itself up neatly right under the header &#8211; where we do NOT want it to be.  So we have to give the footer a special set of instructions:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>and now the whole thing looks <a href='http://www.csstutorial.net/wp-content/uploads/2010/04/3-column03.html'>Like This</a>.  And there you have it!</p>
<p>A few things can go wrong, and here is some easy, preliminary damage control:  If you see your columns NOT all sitting next to each other, it&#8217;s likely because the total sum of all their widths, paddings, and margins combined is GREATER THAN the width of their containing wrapper.  So put one of your columns on a diet and cut its width down some &#8211; and things should fall into place beautifully.  And if not, ask for help at the <a href="http://www.killersites.com/community/index.php?/index">Killersites Community</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.csstutorial.net/2010/04/3-column-layout/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
