<?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>Sycha Web Design &#38; Development &#187; HTML / CSS Tips, Tricks, Tutorials and Hacks</title>
	<atom:link href="http://www.sycha.com/resources/web-development/html-css/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sycha.com</link>
	<description>Website Design &#38; Development</description>
	<lastBuildDate>Mon, 09 May 2011 09:59:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>CSS: Style your &lt;hr&gt; tags with a background image</title>
		<link>http://www.sycha.com/css-style-hr-tag-background-image</link>
		<comments>http://www.sycha.com/css-style-hr-tag-background-image#comments</comments>
		<pubDate>Wed, 13 Oct 2010 22:10:29 +0000</pubDate>
		<dc:creator>Charlie Evans</dc:creator>
				<category><![CDATA[HTML / CSS Resources]]></category>

		<guid isPermaLink="false">http://www.sycha.com/?p=1346</guid>
		<description><![CDATA[I find &#60;hr&#62; (horizontal rule) tags to be a nice semantic way to separate or break up content on a page. To give them some style, you can replace them with a nice background image.]]></description>
			<content:encoded><![CDATA[<p>I find &lt;hr&gt; (horizontal rule) tags to be a nice semantic way to separate or break up content on a page. To give them some style, you can replace them with a nice background image.</p>
<p><img src="http://www.sycha.com/wp-content/uploads/2010/10/spiral-shape.png" alt="" title="spiral-shape" width="255" height="42" class="aligncenter" /></p>
<p>By default, &lt;hr&gt; tags are pretty ugly and basic, a line at their simplest or some 3D bordered monstrosity at worst. Using the CSS background property you can specify an image, just make sure to set the height to be at least that of the image, and set the border to none.</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;">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;">spiral-shape.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">42px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>As usual, Internet Explorer (7 and less) doesn&#8217;t play nice so you need to set up some IE specific CSS (if you care).<br />
I always use a separate IE css file included with a condiional as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!--[if lte IE 7]&gt;
	&lt;link rel='stylesheet' href='ie.css' type='text/css' media='screen' /&gt;
&lt;![endif]--&gt;</pre></div></div>

<p>And the IE hack as follows (Props to <a href="http://blog.neatlysliced.com/2008/03/hr-image-replacement/" target="_blank" rel="nofollow">NeatlySliced</a>):</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;">display</span><span style="color: #3333ff;">:list-</span>item<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">list-style</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;">spiral-shape.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">inside</span><span style="color: #00AA00;">;</span>
	filter<span style="color: #00AA00;">:</span>alpha<span style="color: #00AA00;">&#40;</span>opacity<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><span style="color: #808080; font-style: italic;">/* gets rid of horizontal bar to right of image */</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>		<span style="color: #808080; font-style: italic;">/* prevents tiling */</span>
	<span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">-10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.sycha.com/css-style-hr-tag-background-image/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CSS clearfix: make a floated element automatically fill it&#8217;s parent container</title>
		<link>http://www.sycha.com/css-clearfix-floated-element-automatically-fill-parent-container</link>
		<comments>http://www.sycha.com/css-clearfix-floated-element-automatically-fill-parent-container#comments</comments>
		<pubDate>Fri, 26 Feb 2010 00:59:04 +0000</pubDate>
		<dc:creator>Charlie Evans</dc:creator>
				<category><![CDATA[HTML / CSS Resources]]></category>

		<guid isPermaLink="false">http://www.sycha.com/?p=966</guid>
		<description><![CDATA[Basically this trick 'fixes' the problem that occurs when a floated element doesn't automatically fill out it's parent container..]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not claiming for a second that clearfix is my invention.. If you want some history of it&#8217;s creators, check out this link:<br />
<a href="http://www.positioniseverything.net/easyclearing.html" rel="nofollow" target="_blank">http://www.positioniseverything.net/easyclearing.html</a></p>
<p>As with a lot of tips and techniques on this site, I&#8217;m just making a record of a technique that I use all the time and a version of it that I&#8217;m confident works. This also ensures that I have an online reference that isn&#8217;t going to disappear someday..</p>
<p>So anyway, onto clearfix <img src='http://www.sycha.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Basically this trick &#8216;fixes&#8217; the problem that occurs when a floated element doesn&#8217;t automatically fill out it&#8217;s parent container..<br />
Here&#8217;s some example HTML and an image to illustrate this scenario:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div style=&quot;border:1px solid blue;padding:5px;&quot;&gt;
	&lt;div style=&quot;float:right;width:49%;height:50px;background:green;&quot;&gt;
		&amp;nbsp;
	&lt;/div&gt;	
&nbsp;
	&lt;div style=&quot;width:49%;height:20px;background:red;&quot;&gt;
		&amp;nbsp;
	&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p><img src="http://www.sycha.com/wp-content/uploads/2010/02/floated-element-clearing-problem.png" alt="" title="Floated element clearing problem" width="408" height="71" class="alignnone size-full wp-image-971" /><br />
As you can see, the green div is extending out of it&#8217;s parent container.<br />
i.e. it&#8217;s not expanding the container automatically.</p>
<p>To apply clearfix, simply use the following CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.clearfix</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">visibility</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot; &quot;</span><span style="color: #00AA00;">;</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;">height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
     <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.clearfix</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* start commented backslash hack \*/</span>
<span style="color: #00AA00;">*</span> html <span style="color: #6666ff;">.clearfix</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">1</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.clearfix</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* close commented backslash hack */</span></pre></div></div>

<p>And then add a class=&#8221;clearfix&#8221; to the parent container in your markup:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;clearfix&quot; style=&quot;border:1px solid blue;padding:5px;&quot;&gt;
	&lt;div style=&quot;float:right;width:49%;height:50px;background:green;&quot;&gt;
		&amp;nbsp;
	&lt;/div&gt;	
&nbsp;
	&lt;div style=&quot;width:49%;height:20px;background:red;&quot;&gt;
		&amp;nbsp;
	&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p><img src="http://www.sycha.com/wp-content/uploads/2010/02/clearfix-floated-element-clearing-problem.png" alt="" title="Clearfix floated element clearing problem" width="408" height="76" class="alignnone size-full wp-image-972" /><br />
Now you&#8217;ll see the green div expands the parent container automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sycha.com/css-clearfix-floated-element-automatically-fill-parent-container/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 2/16 queries in 0.005 seconds using disk: basic
Object Caching 245/265 objects using disk: basic

Served from: www.sycha.com @ 2012-02-04 18:45:47 -->
