<?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>Jon Rohan &#187; CSS</title>
	<atom:link href="http://www.dinnermint.org/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dinnermint.org</link>
	<description>I&#039;m a freelance web developer living in San Francisco. This is my portfolio where I share my work, thoughts, and whatever else.</description>
	<lastBuildDate>Sat, 24 Apr 2010 17:01:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<cloud domain='www.dinnermint.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Using CSS3&#8242;s :target pseudo-class to Make a Slideshow</title>
		<link>http://www.dinnermint.org/css/using-css3s-target-pseudo-class-to-make-a-slideshow/</link>
		<comments>http://www.dinnermint.org/css/using-css3s-target-pseudo-class-to-make-a-slideshow/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 18:00:09 +0000</pubDate>
		<dc:creator>Jon Rohan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[pseudo class]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://www.dinnermint.org/?p=2132</guid>
		<description><![CDATA[CSS3 has a lot of cool pseudo-classes. For this experiment I used the :target pseudo-class which lets you target css element based on the element targeted at the end of a url, for example. http://example.com/page#article1 The :target on this page would be the element with the id=&#34;article1&#34;. So if you wanted to place a red [...]]]></description>
			<content:encoded><![CDATA[<p>CSS3 has a lot of cool pseudo-classes. For this experiment I used the :target pseudo-class which lets you target css element based on the element targeted at the end of a url, for example.</p>
<p><pre><code>http://example.com/page#article1
</code></pre></p>
<p>The :target on this page would be the element with the <code>id=&quot;article1&quot;</code>. So if you wanted to place a red dotted border around <code>article1</code>, then you would use something like this.</p>
<p><pre><code>:target { 
&nbsp;&nbsp;border: 1px dotted #FF0000; 
}</code></pre></p>
<p>So I decided to try an experiment and make a slideshow using nothing but HTML and CSS. </p>
<h3>Demo</h3>
<p>Sorry, but no IE&#8217;s allowed. You prob won&#8217;t see anything.</p>
<p><a href="#1">Start Slideshow</a></p>
<ul class="book-pages">
<li id="1">
<div>
<h3>Taming CSS</h3>
<p><small>by Jon Rohan</small>
</div>
<p><span class="slide-info">Slide 1 of 3</span><br />
<a href="#2" class="next">Next</a>
</li>
<li id="2">
<div>
<h3>Never Assume you&#8217;ve mastered it</h3>
</div>
<p><span class="slide-info">Slide 2 of 3</span><br />
<a href="#1" class="last">Last</a><a href="#3" class="next">Next</a></li>
<li id="3">
<div>
<h3>The End</h3>
</div>
<p><span class="slide-info">Slide 3 of 3</span><br />
<a href="#2" class="last">Last</a></li>
</ul>
<h3>Code</h3>
<p><pre><code>&lt;ul class=&quot;book-pages&quot;&gt;
&nbsp;&nbsp;&lt;li id=&quot;1&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h3&gt;Taming CSS&lt;/h3&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;small&gt;by Jon Rohan&lt;/small&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;slide-info&quot;&gt;Slide 1 of 3&lt;/span&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;#2&quot; class=&quot;next&quot;&gt;Next&lt;/a&gt;
&nbsp;&nbsp;&lt;/li&gt;
&nbsp;&nbsp;&lt;li id=&quot;2&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h3&gt;Never Assume you&#039;ve mastered it&lt;/h3&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;slide-info&quot;&gt;Slide 2 of 3&lt;/span&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;#1&quot; class=&quot;last&quot;&gt;Last&lt;/a&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;#3&quot; class=&quot;next&quot;&gt;Next&lt;/a&gt;
&nbsp;&nbsp;&lt;/li&gt;
&nbsp;&nbsp;&lt;li id=&quot;3&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h3&gt;The End&lt;/h3&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;slide-info&quot;&gt;Slide 3 of 3&lt;/span&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;a href=&quot;#2&quot; class=&quot;last&quot;&gt;Last&lt;/a&gt;
&nbsp;&nbsp;&lt;/li&gt;
&lt;/ul&gt;</code></pre></p>
<p>The HTML is a basic unordered list. Each list item will be the slide. Inside each slide is the controls to navigate backward and forward. And a span to display the current slide number.</p>
<p>The main CSS that controls the slideshow, is to just display the current slide, like this.<br />
<pre><code>.book-pages li:target {
&nbsp;&nbsp;display:block;
}</code></pre></p>
<p>And here&#8217;s the rest of the CSS.</p>
<p><pre><code>.book-pages, .book-pages li {
&nbsp;&nbsp;list-style-type:none;
&nbsp;&nbsp;margin:0;
&nbsp;&nbsp;padding:0;
}
ul.book-pages {
&nbsp;&nbsp;margin:30px 0;
}
.book-pages li {
&nbsp;&nbsp;background-color:#111111;
&nbsp;&nbsp;display:none;
&nbsp;&nbsp;height:350px;
&nbsp;&nbsp;margin:0 auto;
&nbsp;&nbsp;position:relative;
&nbsp;&nbsp;text-align:center;
&nbsp;&nbsp;width:510px;
&nbsp;&nbsp;color: #ffffff;
}
.book-pages div {
&nbsp;&nbsp;font-size:1.8em;
&nbsp;&nbsp;padding:120px 25px 0;
&nbsp;&nbsp;line-height:2em;
}
.book-pages li:target {
&nbsp;&nbsp;display:block;
}
.book-pages .next {
&nbsp;&nbsp;position:absolute;
&nbsp;&nbsp;right:0;
&nbsp;&nbsp;bottom:-20px;
}
.book-pages .last {
&nbsp;&nbsp;position:absolute;
&nbsp;&nbsp;left:0;
&nbsp;&nbsp;bottom:-20px;
}
.book-pages .slide-info {
&nbsp;&nbsp;position:absolute;
&nbsp;&nbsp;bottom:-20px;
&nbsp;&nbsp;left:44%;
&nbsp;&nbsp;color:#333333;
}</code></pre></p>


<p>Related posts:<ol><li><a href='http://www.dinnermint.org/tutorial/css3-font-face/' rel='bookmark' title='Permanent Link: CSS 3 @font-face'>CSS 3 @font-face</a></li>
<li><a href='http://www.dinnermint.org/tutorial/css3-text-rotation-clock/' rel='bookmark' title='Permanent Link: CSS Text Rotation Clock'>CSS Text Rotation Clock</a></li>
<li><a href='http://www.dinnermint.org/share/submit-to-digg/' rel='bookmark' title='Permanent Link: Submit to Digg Bookmarklet'>Submit to Digg Bookmarklet</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.dinnermint.org/css/using-css3s-target-pseudo-class-to-make-a-slideshow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Triangles in CSS</title>
		<link>http://www.dinnermint.org/css/creating-triangles-in-css/</link>
		<comments>http://www.dinnermint.org/css/creating-triangles-in-css/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 17:00:59 +0000</pubDate>
		<dc:creator>Jon Rohan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.dinnermint.org/?p=2239</guid>
		<description><![CDATA[I&#8217;ve come across a few techniques and tips in my career, while working at my last gig a co-worker pointed me to this technique. I believe this was originally discovered by the legendary Eric Meyer, but I couldn&#8217;t find much documentation about it on the web so I thought I would describe it here. Demo [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve come across a few techniques and tips in my career, while working at my last gig a co-worker pointed me to this technique. I believe this was originally discovered by the legendary Eric Meyer, but I couldn&#8217;t find much documentation about it on the web so I thought I would describe it here.</p>
<h3>Demo</h3>
<div class="css-arrow-left"></div>
<div class="css-arrow-up"></div>
<div class="css-arrow-right"></div>
<div class="css-arrow-down"></div>
<div class="clearfix"></div>
<h3>How it works</h3>
<p>Few people realize when a browser draws the borders, it draws them at angles. This technique takes advantage of that. One side of the border is colored for the color of the arrow, and the rest are transparent. Then you set the width of the border to something large, the ones above are 20px. To demonstrate here is a div with all sides colored.</p>
<div class="css-arrow-multicolor"></div>
<p><pre><code>&lt;div class=&quot;css-arrow-multicolor&quot;&gt;&lt;/div&gt;

.css-arrow-multicolor {
&nbsp;&nbsp;border-color: red green blue orange;
&nbsp;&nbsp;border-style:solid;
&nbsp;&nbsp;border-width:20px;
&nbsp;&nbsp;width:0;
&nbsp;&nbsp;height:0;
}</code></pre><br />
As you can see there are triangles hidden in that square. These triangles are right triangles with a little tweaking with the border sizes you can get acute triangles.</p>
<div class="css-arrow-acute"></div>
<p><pre><code>.css-arrow-acute {
&nbsp;&nbsp;border-color: red green blue orange;
&nbsp;&nbsp;border-style:solid;
&nbsp;&nbsp;border-width:25px 10px 15px 30px;
&nbsp;&nbsp;width:0;
&nbsp;&nbsp;height:0;
}</code></pre><br />
With a little creativity and tweaking there are lots of shapes that can be made.<br />
<code>border-style:dotted;</code></p>
<div class="css-arrow-multicolor" style="border-style:dotted;"></div>
<p><br/><br />
<code>border-style:dashed;</code></p>
<div class="css-arrow-multicolor" style="border-style:dashed;"></div>
<p><br/><br />
<code>border-style:outset;</code></p>
<div class="css-arrow-multicolor" style="border-style:outset;"></div>
<p><br/><br />
<code>border-style:inset;</code></p>
<div class="css-arrow-multicolor" style="border-style:inset;"></div>
<p><br/><br />
<code>border-style:ridge;</code></p>
<div class="css-arrow-multicolor" style="border-style:ridge;"></div>
<p><br/><br />
<code>border-style:groove;</code></p>
<div class="css-arrow-multicolor" style="border-style:groove;"></div>
<p><br/><br />
<code>border-style:double;</code></p>
<div class="css-arrow-multicolor" style="border-style:double;"></div>
<p><br/><br />
Now for application:</p>
<div class="chat-bubble">
Buongiorno!</p>
<div class="chat-bubble-arrow-border"></div>
<div class="chat-bubble-arrow"></div>
</div>
<p>This is a classic chat bubble, no images used.</p>
<p><pre><code>
&lt;div class=&quot;chat-bubble&quot;&gt;
&nbsp;&nbsp;Buongiorno!
&nbsp;&nbsp;&lt;div class=&quot;chat-bubble-arrow-border&quot;&gt;&lt;/div&gt;
&nbsp;&nbsp;&lt;div class=&quot;chat-bubble-arrow&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

.chat-bubble {
&nbsp;&nbsp;background-color:#EDEDED;
&nbsp;&nbsp;border:2px solid #666666;
&nbsp;&nbsp;font-size:35px;
&nbsp;&nbsp;line-height:1.3em;
&nbsp;&nbsp;margin:10px auto;
&nbsp;&nbsp;padding:10px;
&nbsp;&nbsp;position:relative;
&nbsp;&nbsp;text-align:center;
&nbsp;&nbsp;width:300px;
&nbsp;&nbsp;-moz-border-radius:10px;
&nbsp;&nbsp;-webkit-border-radius:10px;
&nbsp;&nbsp;-moz-box-shadow:0 0 5px #888888;
&nbsp;&nbsp;-webkit-box-shadow:0 0 5px #888888;
}

.chat-bubble-arrow-border {
&nbsp;&nbsp;border-color: #666666 transparent transparent transparent;
&nbsp;&nbsp;border-style: solid;
&nbsp;&nbsp;border-width: 10px;
&nbsp;&nbsp;height:0;
&nbsp;&nbsp;width:0;
&nbsp;&nbsp;position:absolute;
&nbsp;&nbsp;bottom:-22px;
&nbsp;&nbsp;left:30px;
}

.chat-bubble-arrow {
&nbsp;&nbsp;border-color: #EDEDED transparent transparent transparent;
&nbsp;&nbsp;border-style: solid;
&nbsp;&nbsp;border-width: 10px;
&nbsp;&nbsp;height:0;
&nbsp;&nbsp;width:0;
&nbsp;&nbsp;position:absolute;
&nbsp;&nbsp;bottom:-19px;
&nbsp;&nbsp;left:30px;
}</code></pre></p>
<p>This technique doesn&#8217;t work in ie6 as is, mainly because ie6 doesn&#8217;t allow transparent borders, but there is a fix for that. What you need to do is give the &#8220;transparent&#8221; sides a completely different color like pink and then use filter: chroma to turn that color transparent.<br />
<pre><code>&nbsp;&nbsp;/* IE6 */
.chat-bubble-arrow {
&nbsp;&nbsp;&nbsp;&nbsp;_border-left-color: pink;
&nbsp;&nbsp;&nbsp;&nbsp;_border-bottom-color: pink;
&nbsp;&nbsp;&nbsp;&nbsp;_border-right-color: pink;
&nbsp;&nbsp;&nbsp;&nbsp;_filter: chroma(color=pink);
}
</code></pre></p>


<p>Related posts:<ol><li><a href='http://www.dinnermint.org/tutorial/css-clear-fixes/' rel='bookmark' title='Permanent Link: CSS Clear Fixes'>CSS Clear Fixes</a></li>
<li><a href='http://www.dinnermint.org/share/wed-development-bookmarklets/' rel='bookmark' title='Permanent Link: Web Development Bookmarklets'>Web Development Bookmarklets</a></li>
<li><a href='http://www.dinnermint.org/tutorial/targeting-ie6-with-html-css/' rel='bookmark' title='Permanent Link: Targeting IE6 for style'>Targeting IE6 for style</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.dinnermint.org/css/creating-triangles-in-css/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
		</item>
		<item>
		<title>CSS Class Naming Semantic Approach</title>
		<link>http://www.dinnermint.org/css/semantic-css-class-naming/</link>
		<comments>http://www.dinnermint.org/css/semantic-css-class-naming/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 16:30:16 +0000</pubDate>
		<dc:creator>Jon Rohan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[semantic]]></category>
		<category><![CDATA[web standards]]></category>

		<guid isPermaLink="false">http://www.dinnermint.org/?p=2039</guid>
		<description><![CDATA[With the rise of web standards we have seen the rise of the semantic web. This applies to the HTML elements selected as well as the class names chosen for the HTML. When choosing semantic elements and class names you want to pick a name considering the function or meaning of the element as it is on your page, not the position or style of the element. ]]></description>
			<content:encoded><![CDATA[<h3>The Semantic Web</h3>
<p>With the rise of web standards we have seen the rise of the semantic web. This applies to the HTML elements selected as well as the class names chosen for the HTML. When choosing semantic elements and class names you want to pick a name considering the function or meaning of the element as it is on your page, not the position or style of the element. </p>
<h3>The Meaning</h3>
<p>What exactly am I talking about &#8220;meaning&#8221; or &#8220;function&#8221;? This means that when picking a name you want to pick one regardless of where it is, only what it contains or what you&#8217;re using it for. </p>
<p>example: Imagine we have some markup that represents a search result </p>
<p><strong>THE BAD WAY</strong><br />
<pre><code>&lt;div class=&quot;search-result&quot;&gt;
&nbsp;&nbsp;&lt;div class=&quot;search-result-large-header&quot;&gt;&lt;a href=&quot;&quot;&gt;My Search Result&lt;/a&gt;&lt;/div&gt;
&nbsp;&nbsp;&lt;div class=&quot;search-result-gray-description&quot;&gt;This is the best search result&lt;/div&gt;
&nbsp;&nbsp;&lt;div class=&quot;bottom-search-result-info&quot;&gt;&lt;a href=&quot;&quot;&gt;1 comment&lt;/a&gt; &lt;a href=&quot;&quot;&gt;12 views&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</code></pre></p>
<p>There is a lot of things wrong with this. To name a few, there are too many unnecessary DIV&#8217;s;  The class names have style and position specific properties; Since this is a search result, multiples of these makes me want to pass out.</p>
<p><strong>THE SEMANTIC WAY</strong><br />
<pre><code>&lt;div class=&quot;search-result&quot;&gt;
&nbsp;&nbsp;&lt;h3&gt;&lt;a href=&quot;&quot;&gt;My Search Result&lt;/a&gt;&lt;/h3&gt;
&nbsp;&nbsp;&lt;p&gt;This is the best search result&lt;/p&gt;
&nbsp;&nbsp;&lt;div class=&quot;meta&quot;&gt;&lt;a href=&quot;&quot;&gt;1 comment&lt;/a&gt; &lt;a href=&quot;&quot;&gt;12 views&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</code></pre></p>
<p>using the semantic way, I don&#8217;t need as many divs and when I do use a div I try to pick a name that describes what I&#8217;m putting in the tag. I&#8217;m calling it &#8220;meta&#8221; because that info is the meta data for that search result. It has nothing to do with the bottom, and it doesn&#8217;t need &#8220;search-result&#8221; in the name because it is a child of search-result anyways.</p>
<p>I also selected h3 and p elements because an h3 refers to a heading, which the title of the search result is certainly a heading, and p, because this is a paragraph of text which describes the search result. </p>
<p>You may ask, &#8220;What&#8217;s the big deal? It&#8217;s all gonna render the same in the browser anyways?&#8221; The benefits for semantic code translate into faster development time, javascript traversal becomes easier and it makes me happy. :) </p>
<p>Some more bad names that I have witnessed: .padding5px, .topBorderGreen, .redErrorText. What happens if you want a padding of 4px, or suddenly the border becomes blue, or if the error text becomes yellow. Then you&#8217;ll need to go back through all your html and re-name classes. May I suggest names like .content, .important, or .error. </p>


<p>Related posts:<ol><li><a href='http://www.dinnermint.org/tutorial/css3-font-face/' rel='bookmark' title='Permanent Link: CSS 3 @font-face'>CSS 3 @font-face</a></li>
<li><a href='http://www.dinnermint.org/html/doctype-html/' rel='bookmark' title='Permanent Link: &lt;!DOCTYPE HTML&gt;'>&lt;!DOCTYPE HTML&gt;</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.dinnermint.org/css/semantic-css-class-naming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Clear Fixes</title>
		<link>http://www.dinnermint.org/tutorial/css-clear-fixes/</link>
		<comments>http://www.dinnermint.org/tutorial/css-clear-fixes/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 19:18:22 +0000</pubDate>
		<dc:creator>Jon Rohan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[clear]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.dinnermint.org/?p=1811</guid>
		<description><![CDATA[There is a common problem in front end engineering where, when you float an element it is actually removed from it&#8217;s parents&#8217; flow. This can cause the elements below the floating element to run into the floating elements. Like below. The green box is floating and it&#8217;s parent has the red border. The blue box [...]]]></description>
			<content:encoded><![CDATA[<p>There is a common problem in front end engineering where, when you float an element it is actually removed from it&#8217;s parents&#8217; flow. This can cause the elements below the floating element to run into the floating elements. Like below. The green box is floating and it&#8217;s parent has the red border. The blue box is below the red border box.</p>
<div style="border:1px solid red;">
<div style="background-color:green;float:left;width:20px;height:20px;"></div>
</div>
<div style="background-color:blue;width:50px;height:50px;"></div>
<p>There are a few solutions to this, but I have heard of a new solution that I don&#8217;t think is widely published. overflow:hidden;</p>
<p>First lets go through the other solutions. </p>
<h3>clear:both</h3>
<p>This is the most common that I&#8217;ve found, and the one I&#8217;ve used the most. The style in this code is inline, but typically you can just create a class called .clear and apply these styles.</p>
<div style="border:1px solid red;">
<div style="background-color:green;float:left;width:20px;height:20px;"></div>
<div style="clear:both;"></div>
</div>
<div style="background-color:blue;width:50px;height:50px;"></div>
<p><pre><code>&lt;div style=&quot;border:1px solid red;&quot;&gt;
&nbsp;&nbsp;&lt;div style=&quot;background-color:green;float:left;width:20px;height:20px;&quot;&gt;&lt;/div&gt;
&nbsp;&nbsp;&lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color:blue;width:50px;height:50px;&quot;&gt;&lt;/div&gt;&nbsp;&nbsp; 
</code></pre></p>
<p>In this example you place another element at the end of the child elements in the red border box. This last element gets applied the style clear:both which disallows any floating elements on either side of it.</p>
<p>This can run into problems if you have multi-column layouts this can clear the content in the other columns</p>
<h3>clearfix hack</h3>
<p>This is essentially taking the previous method and adding to it. I don&#8217;t use this very often.</p>
<p><pre><code>.clearfix :after&nbsp;&nbsp;{
&nbsp;&nbsp;content :&nbsp;&nbsp;&quot;.&quot; ; 
&nbsp;&nbsp;display :&nbsp;&nbsp;block ; 
&nbsp;&nbsp;clear :&nbsp;&nbsp;both ; 
&nbsp;&nbsp;visibility :&nbsp;&nbsp;hidden ; 
&nbsp;&nbsp;line-height :&nbsp;&nbsp;0 ; 
&nbsp;&nbsp;height :&nbsp;&nbsp;0 ; 
} 
 
.clearfix&nbsp;&nbsp;{ 
&nbsp;&nbsp;display :&nbsp;&nbsp;inline-block ; 
} 
 
html[ xmlns]&nbsp;&nbsp;.clearfix&nbsp;&nbsp;{ 
&nbsp;&nbsp;display :&nbsp;&nbsp;block ; 
} 
 
*&nbsp;&nbsp;html .clearfix&nbsp;&nbsp;{ 
&nbsp;&nbsp;height :&nbsp;&nbsp;1 % ; 
}
</code></pre></p>
<div style="border:1px solid red;">
<div style="background-color:green;float:left;width:20px;height:20px;"></div>
<div class="clearfix"></div>
</div>
<div style="background-color:blue;width:50px;height:50px;"></div>
<p>This method works but it feels like a lot of overhead, and now my CSS is non-standard.</p>
<h3>overflow:hidden</h3>
<p>In this method you apply overflow:hidden to the parent element which is the red border box. And that&#8217;s it!</p>
<div style="border:1px solid red;overflow:hidden;">
<div style="background-color:green;float:left;width:20px;height:20px;"></div>
</div>
<div style="background-color:blue;width:50px;height:50px;"></div>
<p><pre><code>&lt;div style=&quot;border:1px solid red;overflow:hidden;&quot;&gt;&nbsp;&nbsp;
&nbsp;&nbsp;&lt;div style=&quot;background-color:green;float:left;width:20px;height:20px;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color:blue;width:50px;height:50px;&quot;&gt;&lt;/div&gt; 
</code></pre></p>
<p>Pretty simple! And it doesn&#8217;t require extra div tags. I&#8217;ve tested this in IE7, Firefox, Safari, and Chrome works in all.</p>


<p>Related posts:<ol><li><a href='http://www.dinnermint.org/css/creating-triangles-in-css/' rel='bookmark' title='Permanent Link: Creating Triangles in CSS'>Creating Triangles in CSS</a></li>
<li><a href='http://www.dinnermint.org/share/wed-development-bookmarklets/' rel='bookmark' title='Permanent Link: Web Development Bookmarklets'>Web Development Bookmarklets</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.dinnermint.org/tutorial/css-clear-fixes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CSS 3 @font-face</title>
		<link>http://www.dinnermint.org/tutorial/css3-font-face/</link>
		<comments>http://www.dinnermint.org/tutorial/css3-font-face/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 01:47:54 +0000</pubDate>
		<dc:creator>Jon Rohan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[semantic]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[web standards]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://www.dinnermint.org/?p=1755</guid>
		<description><![CDATA[Surprisingly embed-able opentype fonts have been included in Internet Explorer since version 4. But with the recent release of Firefox 3.5 and Safari, you can now embed Opentype and Truetype fonts across all major browsers. It&#8217;s pretty simple and here&#8217;s how it&#8217;s done. First you must define your font, basically tell the browser where to [...]]]></description>
			<content:encoded><![CDATA[<p>Surprisingly embed-able opentype fonts have been included in Internet Explorer since version 4. But with the recent release of Firefox 3.5 and Safari, you can now embed Opentype and Truetype fonts across all major browsers. It&#8217;s pretty simple and here&#8217;s how it&#8217;s done.</p>
<p>First you must define your font, basically tell the browser where to get the font file, and what you&#8217;re going to call it.<br />
<pre><code>/* For IE */

@font-face {
font-family: &#039;Komika Display&#039;;
src: url(&#039;Komika_display.eot&#039;);
}

/* For Other Browsers */

@font-face {
font-family: &#039;Komika Display&#039;;
src: local(&#039;Komika Display Regular&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; local(&#039;KomikaDisplay-Regular&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; url(&#039;Komika_display.ttf&#039;) format(&#039;truetype&#039;);
}

@font-face {
font-family: &#039;Komika Display&#039;;
src: local(&#039;Komika Display Bold&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; local(&#039;KomikaDisplay-Bold&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; url(&#039;Komika_display_bold.ttf&#039;) format(&#039;truetype&#039;);
font-weight: bold;
}

@font-face {
font-family: &#039;Komika Display Kaps&#039;;
src: local(&#039;Komika Display Kaps Regular&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; local(&#039;KomikaDisplayKaps-Regular&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; url(&#039;Komika_display_kaps.ttf&#039;) format(&#039;truetype&#039;);
}

@font-face {
font-family: &#039;Komika Display Kaps&#039;;
src: local(&#039;Komika Display Kaps Bold&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; local(&#039;KomikaDisplayKaps-Bold&#039;),
&nbsp;&nbsp;&nbsp;&nbsp; url(&#039;Komika_display_kaps_bold.ttf&#039;) format(&#039;truetype&#039;);
font-weight: bold;
}
</code></pre><br />
ok, now that you have defined your font, you can use it.</p>
<p><pre><code>body {
&nbsp;&nbsp;font-family: Komika Display Kaps, sans-serif;
}
</code></pre></p>
<p>And here&#8217;s what it looks like:</p>
<div class="font_face_demo">This should be the demo font face</div>
<p>The second part of this tutorial is should you use font-face?</p>
<p>This is another call to your server, which when u have a huge website, isn&#8217;t a great thing. But compared to most things on a website, this size is tiny.</p>
<p>You have to consider too, for the designers who need the exact font everywhere this is a better alternative than to cut images for every heading on the website, or for the nav. And bonus! The text is still crawl-able by search engines. </p>


<p>Related posts:<ol><li><a href='http://www.dinnermint.org/css/using-css3s-target-pseudo-class-to-make-a-slideshow/' rel='bookmark' title='Permanent Link: Using CSS3&#8242;s :target pseudo-class to Make a Slideshow'>Using CSS3&#8242;s :target pseudo-class to Make a Slideshow</a></li>
<li><a href='http://www.dinnermint.org/html/doctype-html/' rel='bookmark' title='Permanent Link: &lt;!DOCTYPE HTML&gt;'>&lt;!DOCTYPE HTML&gt;</a></li>
<li><a href='http://www.dinnermint.org/tutorial/css3-text-rotation-clock/' rel='bookmark' title='Permanent Link: CSS Text Rotation Clock'>CSS Text Rotation Clock</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.dinnermint.org/tutorial/css3-font-face/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
