<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>RedTeamDesign</title>
	
	<link>http://www.red-team-design.com</link>
	<description>CSS tips and tricks</description>
	<lastBuildDate>Mon, 28 May 2012 05:00:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/redteamdesign" /><feedburner:info uri="redteamdesign" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>redteamdesign</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Thoughts on upcoming CSS parent selector</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/4xUL14tFKt8/css-parent-selector</link>
		<comments>http://www.red-team-design.com/css-parent-selector#comments</comments>
		<pubDate>Mon, 28 May 2012 05:00:45 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS4]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4664</guid>
		<description><![CDATA[I wrote a while ago about the future CSS4 Selectors, namely about CSS Selectors Level 4 Working Draft release. It was such a good news to see that things are continuously moving on. I&#8217;m saying that because it&#8217;s a long way until CSS3 will reach final recommendation phase and yet we&#8217;re seeing news about the [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a while ago about the future <a href="http://www.red-team-design.com/meet-the-css4-selectors">CSS4 Selectors</a>, namely about CSS Selectors Level 4 Working Draft release. It was such a good news to see that things are continuously moving on. I&#8217;m saying that because it&#8217;s a long way until CSS3 will reach final recommendation phase and yet we&#8217;re seeing news about the future CSS4. Isn&#8217;t that cool? </p>
<p>Meanwhile, I thought a little bit about the upcoming CSS parent selector. At this time, if you ask me, I think it will be the most awesome feature and definitely is at the top of my CSS wishlist.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/05/css-parent-selector.png" alt="" title="CSS parent selector" width="600" height="200" class="aligncenter size-full wp-image-4710" /></p>
<p><span id="more-4664"></span></p>
<h3>Syntax</h3>
<p>Ever since the CSS parent selector was brought into attention, there has been a lot of discussion regarding its syntax. Mostly disapproving the way the syntax looks in currently Working Draft:</p>
<pre class="prettyprint">
$E > F{
    background: #fff;
}
</pre>
<p><em>Select an E element parent of an F element.</em></p>
<p>However, along with the latest <a href="http://dev.w3.org/csswg/selectors4/#subject">Editor&#8217;s Draft</a>, it seems that things improved a bit:</p>
<pre class="prettyprint">
E! > F{
    background: #fff;
}
</pre>
<p><em>Again, the newest syntax that helps determining the subject of a selector.</em></p>
<p>Well, this will probably not be the last edit to the syntax so I bet we&#8217;ll witness more changes in the future. </p>
<h3>CSS parent selector in practice</h3>
<p>This article is not about the syntax itself, it&#8217;s more about how would you use the CSS parent selector in your daily work? Also, how much can this help you writing <strong>better and smarter lines of CSS</strong>? </p>
<p>These are the questions I&#8217;m asking myself lately about this matter so I thought about some example scenarios:</p>
<h4>Dropdown menu</h4>
<p>For <a href="http://www.red-team-design.com/css3-animated-dropdown-menu">CSS dropdown menus</a>, we would be able to style the <code>li</code> accordingly when it contains a sub menu.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/05/css-dropdown.png" alt="" title="CSS dropdown" width="600" height="200" class="aligncenter size-full wp-image-4707" /></p>
<p>In this case, for the Categories section, here&#8217;s how we could add an arrow to the right for the parent list element:</p>
<pre class="prettyprint">
li! > ul{
  background: url(arrow.png) no-repeat right center;
  padding: 0 20px 0 0;
}
</pre>
<h4>Interactive form</h4>
<p>As I mentioned in my previous <a href="http://www.red-team-design.com/meet-the-css4-selectors">CSS4 selectors</a> article, highlighting a form when an inner input is focused could be a practical example for the CSS parent selector.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2011/12/css4-selectors-fieldset.png" alt="Interactive form" /></p>
<pre class="prettyprint">
fieldset! > input:focus{
  background: #f3eab1; /* light yellow */
}
</pre>
<h4>New clearing method</h4>
<p>With this new powerful selector, I think we could have all the ingredients to use a new <a href="http://www.red-team-design.com/clearing-floats-nowadays">clearing floats</a> method based on already existing ones.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2011/08/clearing-floats.png" alt="Clearing floats" /></p>
<p>Thinking there&#8217;s absolutely no situation when you wouldn&#8217;t want to clear the floats within a wrapper, if having the markup below:</p>
<pre class="prettyprint">
&lt;div&gt;
  &lt;div class="float-left"&gt;&lt;/div&gt;
  &lt;div class="float-right"&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>and a CSS framework that contains:</p>
<pre class="prettyprint">
.float-left{
  float: left;
}
.float-right{
  float: right;
}
</pre>
<p>&#8230; this could be a future clearing solution:</p>
<pre class="prettyprint">
div:before! > .float-left, div:after! > .float-left,
div:before! > .float-right, div:after! > .float-right{
  content:"";
  display:table;
}

div:after! > .float-left,
div:after! > .float-right{
  clear:both;
}

div! > .float-left,
div! > .float-right{
  zoom:1;
}
</pre>
<p>If it would be to translate the above: if a <code>div</code> contains a <code>.float-left</code> or <code>.float-right</code> then clear the floats properly.</p>
<h3>CSS parent selector will rock</h3>
<p>I&#8217;m pretty sure that, once it will be supported, a lot of clever techniques will appear in the wild. The above situations are just some ideas I had in mind and I wanted to share with you. </p>
<p>The cool thing is that we won&#8217;t need to rely on JavaScript to select a parent element and this opens way to new opportunities.</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/4xUL14tFKt8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/css-parent-selector/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/css-parent-selector</feedburner:origLink></item>
		<item>
		<title>Google Play’s minimal tabs with CSS3 &amp; jQuery</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/KD42d54JW5g/google-play-minimal-tabs-with-css3-jquery</link>
		<comments>http://www.red-team-design.com/google-play-minimal-tabs-with-css3-jquery#comments</comments>
		<pubDate>Mon, 21 May 2012 05:00:34 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[User experience]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4617</guid>
		<description><![CDATA[The tab navigation is an element you often meet in your daily browsing. There are so many ways, so many styles, but the idea is the same: you click a tab and see its content without a page refresh. In this article you&#8217;ll learn how to build some new CSS3 &#038; jQuery tabs inspired by [...]]]></description>
			<content:encoded><![CDATA[<p>The tab navigation is an element you often meet in your daily browsing. There are so many ways, so many styles, but the idea is the same: you click a tab and see its content without a page refresh.</p>
<p>In this article you&#8217;ll learn how to build some new CSS3 &#038; jQuery tabs inspired by <a href="https://play.google.com">Google Play</a>&#8216;s design.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/05/minimal-tabs-css3-jquery.png" alt="" title="Minimal tabs with CSS3 &amp; jQuery" width="600" height="200" class="aligncenter size-full wp-image-4628" /></p>
<p><span id="more-4617"></span></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/05/google-play-minimal-tabs-with-css3-jquery-demo.html">View demo</a>
</p>
<p>Before going further, you may want to check the other tabs tutorials I wrote:</p>
<p><a href="http://www.red-team-design.com/css3-tabs-with-beveled-corners"><img src="http://www.red-team-design.com/wp-content/uploads/2011/09/css3-jquery-tabs.png" alt="CSS3 tabs with beveled corners" /></a><br />
<em><a href="http://www.red-team-design.com/css3-tabs-with-beveled-corners">CSS3 tabs with beveled corners</a></em></p>
<p><a href="http://www.red-team-design.com/css3-jquery-folder-tabs"><img src="http://www.red-team-design.com/wp-content/uploads/2012/01/css3-jquery-folder-tabs.png" alt="CSS3 &#038; jQuery folder tabs" /></a><br />
<em><a href="http://www.red-team-design.com/css3-jquery-folder-tabs">CSS3 &#038; jQuery folder tabs</a></em></p>
<h3>The HTML</h3>
<p>Getting back to this tutorial, here&#8217;s the markup, simple as usual. You may notice the similarity between an anchor&#8217;s <code>name</code> attribute and related content&#8217;s <code>id</code> block. Further, this will be our hook.</p>
<pre class="prettyprint">
&lt;ul id="tabs"&gt;
    &lt;li&gt;&lt;a href="#" name="#tab1"&gt;One&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab2"&gt;Two&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab3"&gt;Three&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" name="#tab4"&gt;Four&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div id="content"&gt;
    &lt;div id="tab1"&gt;...&lt;/div&gt;
    &lt;div id="tab2"&gt;...&lt;/div&gt;
    &lt;div id="tab3"&gt;...&lt;/div&gt;
    &lt;div id="tab4"&gt;...&lt;/div&gt;
&lt;/div&gt;
</pre>
<h3>The CSS</h3>
<p>The goal here, as always, is to do it without using any images and with as little CSS as possible.</p>
<p>That&#8217;s all, this is not just a CSS piece, it&#8217;s the whole CSS used to create these tabs. I think it&#8217;s pretty cool, not even <a href="http://www.red-team-design.com/before-after-pseudo-elements">pseudo-elements</a> were used here, just CSS borders.</p>
<pre class="prettyprint">
#tabs {
  overflow: hidden;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

#tabs li {
  float: left;
  margin: 0 -15px 0 0;
}

#tabs a {
  float: left;
  position: relative;
  padding: 0 40px;
  height: 0;
  line-height: 30px;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  border-right: 30px solid transparent;
  border-bottom: 30px solid #3D3D3D;
  border-bottom-color: #777\9;
  opacity: .3;
  filter: alpha(opacity=30);
}

#tabs a:hover,
#tabs a:focus {
  border-bottom-color: #2ac7e1;
  opacity: 1;
  filter: alpha(opacity=100);
}

#tabs a:focus {
  outline: 0;
}

#tabs #current {
  z-index: 3;
  border-bottom-color: #3d3d3d;
  opacity: 1;
  filter: alpha(opacity=100);
}
</pre>
<h4>Deconstructing it</h4>
<p>Here&#8217;s where the magic happens:</p>
<pre class="prettyprint">
#tabs a {
  height: 0;
  line-height: 30px;
  border-right: 30px solid transparent;
  border-bottom: 30px solid #3D3D3D;
}
</pre>
<p><em>Styles excerpt</em></p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/05/css-border-tabs-technique.png" alt="" title="CSS border tabs technique" width="600" height="200" class="aligncenter size-full wp-image-4648" /><br />
<em>CSS border tabs technique example</em></p>
<h3>The jQuery</h3>
<p>Comparing to my previous tabs article, this time I think I improved a bit the jQuery code. Also, this time you have the possibility to access the tabs directly by URL, e.g. mywebsite.com/tabs.html#tab2.</p>
<pre class="prettyprint">
function resetTabs(){
    $("#content div").hide(); //Hide all content
    $("#tabs a").attr("id",""); //Reset id's
}

var myUrl = window.location.href; //get URL
var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For mywebsite.com/tabs.html#tab2, myUrlTab = #tab2
var myUrlTabName = myUrlTab.substring(0,4); // For the above example, myUrlTabName = #tab

(function(){
    $("#content div").hide(); // Initially hide all content
    $("#tabs li:first a").attr("id","current"); // Activate first tab
    $("#content div:first").fadeIn(); // Show first tab content

    $("#tabs a").on("click",function(e) {
        e.preventDefault();
        if ($(this).attr("id") == "current"){ //detection for current tab
         return
        }
        else{
        resetTabs();
        $(this).attr("id","current"); // Activate this
        $($(this).attr('name')).fadeIn(); // Show content for current tab
        }
    });

    for (i = 1; i <= $("#tabs li").length; i++) {
      if (myUrlTab == myUrlTabName + i) {
          resetTabs();
          $("a[name='"+myUrlTab+"']").attr("id","current"); // Activate url tab
          $(myUrlTab).fadeIn(); // Show url tab content
      }
    }
})()
</pre>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/05/google-play-minimal-tabs-with-css3-jquery-demo.html">View demo</a>
</p>
<h3>In the end...</h3>
<p>This technique has a small drawback, the tabs do not behave as they should if you're using IE6. But, with your permission, I'd say we could skip IE6 this time. However, if you really want a graceful degradation for IE6, it can be done with some specific targeting. Maybe I'll do that in the future, or maybe not :)</p>
<p>I'm looking forward to read your comments, hope you enjoyed this. Thanks for reading it!</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/KD42d54JW5g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/google-play-minimal-tabs-with-css3-jquery/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/google-play-minimal-tabs-with-css3-jquery</feedburner:origLink></item>
		<item>
		<title>CSS filter effects in action</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/i8eRteNmjIg/css-filter-effects-in-action</link>
		<comments>http://www.red-team-design.com/css-filter-effects-in-action#comments</comments>
		<pubDate>Wed, 02 May 2012 05:00:45 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4562</guid>
		<description><![CDATA[Ever since CSS filter effects landed in WebKit, I thought about theirs practical implementation. How will they fit with the current web design trends? At this time, my initial impressions are that the best way to showcase the power of CSS filters is something like an image gallery. With so many CSS filters to choose [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since CSS filter effects landed in WebKit, I thought about theirs practical implementation. How will they fit with the current web design trends? At this time, my initial impressions are that the best way to showcase the power of CSS filters is something like an image gallery.</p>
<p>With so many CSS filters to choose from, it will be fun to create image galleries in the future. Further in this article we&#8217;ll create a simple image gallery using CSS filters and the CSS3 <code>:not</code> selector.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/05/css-filter-effects-in-action.png" alt="" title="CSS filter effects in action" width="600" height="200" class="aligncenter size-full wp-image-4581" /></p>
<p><span id="more-4562"></span></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/05/css-filter-effects-in-action-demo.html">View demo</a>
</p>
<p>Whilst at the beginning we had just WebKit nightlies support, now you can view the filter effects using <a href="http://tools.google.com/dlpage/chromesxs">Chrome Canary</a> too. I encourage you to download it in order to view the <a href="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html">CSS filter effects</a> in action. Also, I&#8217;m pretty sure that soon we&#8217;ll see filters support also in stable Chrome&#8217;s releases.</p>
<p>Here are the current filter effects: <code>grayscale</code>, <code>sepia</code>, <code>saturate</code>, <code>hue-rotate</code>, <code>opacity</code>, <code>invert</code>, <code>brightness</code>, <code>contrast</code>, <code>blur</code>, <code>drop-shadow</code>. Read more about them <a href="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html">here</a>.</p>
<p>In this article we&#8217;ll be using just the <code>blur</code> and <code>grayscale</code> effects in order to create our small gallery. Also, the CSS3 <code>:not</code> selector will help us here as you&#8217;ll see below.</p>
<h3>The HTML</h3>
<p>Getting back to our image gallery, let&#8217;s see how the markup looks like:</p>
<pre class="prettyprint">
&lt;ul class="gallery"&gt;
  &lt;li&gt;&lt;img src="1.jpg"&gt;&lt;/li&gt;
  ...
  &lt;li&gt;&lt;img src="6.jpg"&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<h3>The CSS</h3>
<p>I think it&#8217;s the first time in a long time when I don&#8217;t have too many CSS lines to show you. This time, less is more :)</p>
<p>The interesting part is related to the <code>.gallery:hover li:not(:hover)</code> selector. When you hover over the list, we&#8217;ll assume you&#8217;ll hover also over a list element and we&#8217;ll apply some filters to the non hovered list elements.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/05/css-filter-effects-in-action-example.jpg" alt="" title="CSS filter effects in action - example" width="600" height="200" class="aligncenter size-full wp-image-4588" /><br />
<em>This is how the other images looks like when the tulip image is hovered.</em></p>
<pre class="prettyprint">
.gallery{
  list-style: none;
  margin: 50px auto; padding: 0;
  width: 642px;
  font-size: 0; /* fix inline-block spacing */
}

.gallery li{
    display: inline-block;
    *display: inline;
    zoom: 1;
    width: 200px; height: 150px;
    margin: 2px;
    border: 5px solid #fff;
    box-shadow: 0 2px 2px rgba(0,0,0,.1);
    transition: all .3s ease;
}

.gallery:hover li:not(:hover){
    -webkit-filter: blur(2px) grayscale(1);
    opacity: .7; /* fallback */
}
</pre>
<p>For this example I chose to use <code>inline-block</code> instead <code>float</code> and <code>font-size: 0</code> is my &#8220;kung-fu&#8221; move to <a href="http://css-tricks.com/fighting-the-space-between-inline-block-elements/">fight the space between inline-block elements</a>.</p>
<p>Regarding degradation, here&#8217;s my method:</p>
<ul>
<li>If the browser support CSS filters and <code>:not</code>, then apply filters and also decrease opacity.</li>
<li>If the browser does not support CSS filters (currently all except Canary) but it does support the <code>:not</code>, then just decrease opacity.</li>
<li>If the <a href="http://www.red-team-design.com/how-to-solve-common-ie-bugs">browser is too old</a> and does not support neither opacity nor <code>:not</code> <a href="http://caniuse.com/#search=:not">selector</a>, then do nothing.</li>
</ul>
<h3>Browser support</h3>
<p>Here&#8217;s the current support for the CSS filter effects: Chrome 20.0.1123.0 (currently Canary) and Webkit nightly.</p>
<h3>Conclusion</h3>
<p><strong>The future sounds good</strong>. We already have a Flexbox Module and CSS Filters, I like to think that in the near future we&#8217;ll also have <a href="http://www.red-team-design.com/css-variables">variables</a> and the <a href="http://www.red-team-design.com/meet-the-css4-selectors">CSS parent selector</a> ready to use. Exciting times for web developers, don&#8217;t you think so?</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/i8eRteNmjIg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/css-filter-effects-in-action/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/css-filter-effects-in-action</feedburner:origLink></item>
		<item>
		<title>Interactive menu with CSS3 &amp; jQuery</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/iiY20Gs6jyA/interactive-menu-with-css3-jquery</link>
		<comments>http://www.red-team-design.com/interactive-menu-with-css3-jquery#comments</comments>
		<pubDate>Mon, 23 Apr 2012 05:00:37 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[accessibility]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4486</guid>
		<description><![CDATA[I&#8217;ve had this example in mind for a while now and seeing something similar in the wild, made me want to write this article down. So, in this article you&#8217;ll learn how to create an interactive menu using CSS3 goodness and jQuery&#8217;s power. View demoDownload .zip The idea The idea behind this example was to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had this example in mind for a while now and seeing something similar <em>in the wild</em>, made me want to write this article down. </p>
<p>So, in this article you&#8217;ll learn how to create an interactive menu using CSS3 goodness and jQuery&#8217;s power.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-with-css3-jquery-preview.png" alt="" title="Interactive menu with CSS3 &amp; jQuery Preview" width="600" height="200" class="aligncenter size-full wp-image-4490" /></p>
<p><span id="more-4486"></span></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-css3-jquery-demo.html">View demo</a><a class="download" href="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-css3-jquery.zip">Download .zip</a>
</p>
<h3>The idea</h3>
<p>The idea behind this example was to have some nicely arranged blocks and once you click on one of them, the block will start showing its hidden content starting at its current position.</p>
<p>Besides being a menu, this example can also serve as a perfect single page website. For example, just think that a block can be named &#8220;Contact&#8221; and could contain a nice contact form.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-with-css3-jquery-idea.png" alt="" title="Interactive menu with CSS3 &amp; jQuery idea" width="600" height="378" class="aligncenter size-full wp-image-4546" /></p>
<h3>The HTML</h3>
<p>Nothing too complicated here, each block has a title that is hidden once its adjacent content will be triggered. Regarding <code>tabindex</code> will discuss a little later.</p>
<pre class="prettyprint">
  &lt;ul class="menu"&gt;
    &lt;li tabindex="1"&gt;
      &lt;span class="title"&gt;One&lt;/span&gt;
      &lt;div class="content"&gt;Lorem ipsum dolor sit amet...&lt;/div&gt;
    &lt;/li&gt;
	...
    &lt;li tabindex="1"&gt;
      &lt;span class="title"&gt;Nine&lt;/span&gt;
      &lt;div class="content"&gt;Lorem ipsum dolor sit amet...&lt;/div&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
</pre>
<h3>The CSS</h3>
<p>In the following rows I&#8217;ll try to explain a bit the styles that were used to create this example.</p>
<h4>Wrapper</h4>
<p>First of all we&#8217;re going to add some basic styles for our list wrapper including clearing floats. Also, you may have noticed the <code>counter-reset: li;</code> declaration, you&#8217;ve <a href="http://www.red-team-design.com/css3-ordered-list-styles">seen it before</a> and we&#8217;ll use it further again to create a nice counter effect.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/unordered-list-styles.png" alt="" title="Unordered list styles" width="600" height="200" class="aligncenter size-full wp-image-4532" /></p>
<pre class="prettyprint">
.menu{
  width: 620px;
  margin: 100px auto; padding: 15px;
  list-style: none;
  counter-reset: li;
  background: #eee;
  box-shadow: 0 1px 2px rgba(0,0,0,.1) inset;
  border-radius: 10px;
}

.menu:before,
.menu:after {
  content: "";
  display: table;
}

.menu:after {
  clear: both;
}

.menu {
  zoom:1;
}
</pre>
<h4>List element</h4>
<p>Below you can find the CSS rules used in order to add some basic styles for list elements.</p>
<p>Things to note:</p>
<ul>
<li>On <code>:focus</code> we&#8217;ll use the same styling as on <code>:hover</code>. This is necessary when using keyboard&#8217;s tab key.</li>
<li>The CSS <code>.cover</code> class is dynamically added (with jQuery) to an <code>li</code> element when it&#8217;s triggered.</li>
<li>If the trigger is made through ENTER key, using <code>outline: 0;</code> declaration will help removing focus styling.</li>
<li>Numbering system, similar to <a href="http://www.red-team-design.com/css3-ordered-list-styles">CSS3 ordered lists</a>.</li>
</ul>
<pre class="prettyprint">
.menu li {
  position: relative;
  float: left;
  cursor: pointer;
  height: 120px; width: 200px;
  margin: 10px 0 0 10px;
  color: #fff;
} 

.menu li:hover, .menu li:focus{
  background-image: linear-gradient(top, rgba(255,255,255,.2), rgba(255,255,255,0));
}

.menu .cover{
  z-index: 2;
}

.menu .cover:focus{
  outline: 0;
}

/* -------------------------------- */

.menu li::after{
  content: counter(li);
  counter-increment: li;
  font: italic bold 10px serif, georgia;
  position: absolute;
  color: rgba(255,255,255,.1);
  opacity: 0;
  transition: all .2s ease-out;
}      

.menu li:hover::after, .menu li:focus::after{
  font-size: 100px;
  opacity: 1;
}

.menu .cover::after{
  z-index: -1;
}
</pre>
<h4>Clean li&#8217;s margins and colorize them</h4>
<p>Above we&#8217;re using <code>margin: 10px 0 0 10px;</code> to add spacing between elements, now we have to clean some of them. Also we&#8217;ll colorize the <code>li</code> elements along with its content window and close button. </p>
<p>In this case, to colorize <code>.content</code> and <code>.close</code> for each <code>li</code>, it would have been great to just use <code>background: inherit;</code> declaration. But, due browser inconsistency we&#8217;re going to use the &#8220;hard&#8221; way, as you can see below:</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-with-css3-progress.png" alt="" title="Interactive menu with CSS3 &amp; jQuery - progress" width="600" height="200" class="aligncenter size-full wp-image-4547" /></p>
<pre class="prettyprint">
.menu li:nth-child(1),
.menu li:nth-child(2),
.menu li:nth-child(3){
  margin-top: 0;
}

.menu li:nth-child(1),
.menu li:nth-child(4),
.menu li:nth-child(7){
  margin-left: 0;
}

/* -------------------------------- */       

.menu li:nth-child(1),
.menu li:nth-child(1) .content,
.menu li:nth-child(1) .close{
  background-color: #2c618f;
}         

.menu li:nth-child(2),
.menu li:nth-child(2) .content,
.menu li:nth-child(2) .close{
  background-color: #91ab31;
}   

.menu li:nth-child(3),
.menu li:nth-child(3) .content,
.menu li:nth-child(3) .close{
  background-color: #714a28;
}

.menu li:nth-child(4),
.menu li:nth-child(4) .content,
.menu li:nth-child(4) .close{
  background-color: #e58600;
}

.menu li:nth-child(5),
.menu li:nth-child(5) .content,
.menu li:nth-child(5) .close{
  background-color: #c33a00;
}

.menu li:nth-child(6),
.menu li:nth-child(6) .content,
.menu li:nth-child(6) .close{
  background-color: #7f5dac;
}

.menu li:nth-child(7),
.menu li:nth-child(7) .content,
.menu li:nth-child(7) .close{
  background-color: #5672b7;
}

.menu li:nth-child(8),
.menu li:nth-child(8) .content,
.menu li:nth-child(8) .close{
  background-color: #69003f;
}

.menu li:nth-child(9),
.menu li:nth-child(9) .content,
.menu li:nth-child(9) .close{
  background-color: #393043;
}
</pre>
<h4>Title, Content and Close</h4>
<p>Regarding the styles for <code>.content</code> window:</p>
<ul>
<li>When the <code>.expanded</code> class is added to it, its height and width are transitioned to cover the entire list.</li>
<li>Please notice the comments to see how the elements in the grid &#8220;respond&#8221; once they&#8217;ll be triggered. </li>
</ul>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-with-css3-jquery-final.png" alt="" title="Interactive menu with CSS3 &amp; jQuery - final" width="600" height="380" class="aligncenter size-full wp-image-4548" /><br />
<em>In this screenshot, you can see the fifth block hovered.</em></p>
<pre class="prettyprint">
.menu .content{
  opacity: 0; display: none\9;
  overflow: hidden;
  font: 12px Arial, Helvetica;
  position: absolute;
  height: 120px; width: 200px;
  transition: all .3s ease-out;
}  

.menu .expanded{
  opacity: .95; display: block\9;
  overflow: visible;
  padding: 40px;
  height: 300px; width: 540px; /* Cover the entire area */
}

.menu li:nth-child(3n) .content{ /* 3,6,9 */
  right: 0;
}

.menu li:nth-child(3n-1) .expanded{ /* 2,5,8 */
  left: 50%;
  margin-left: -310px;
}

.menu li:nth-child(7) .content, /* 7,8,9 */
.menu li:nth-child(8) .content,
.menu li:nth-child(9) .content{
  bottom: 0;
}                      

.menu li:nth-child(4) .expanded, /* 4,5,6 */
.menu li:nth-child(5) .expanded,
.menu li:nth-child(6) .expanded{
  margin-top: -190px;
  top: 50%;
} 

/* -------------------------------- */    

.menu .title{
  position: absolute;
  height: 100%; width: 100%;
  text-align: center;
  font: italic bold 1em/120px 'trebuchet MS', Arial, helvetica;
  opacity: .2;
}

.menu li:hover .title{
  opacity: .7;
}    

/* -------------------------------- */

.menu .close {
  /*background: inherit;*/
  display: none;
  border: 5px solid #fff;
  color: #fff;
  cursor: pointer;
  height: 40px; width: 40px;
  font: bold 20px/40px arial, helvetica;
  position: absolute;
  text-align: center;
  top: -20px; right: -20px;
  border-radius: 40px;
}

.menu .cover .close{
  display: block;
}
</pre>
<h3>The jQuery</h3>
<p>Below you have the jQuery code, I think it&#8217;s quite easy to follow and understand:</p>
<pre class="prettyprint">
(function(){

// Append a close trigger for each block
$('.menu .content').append('<span class="close">x</span>');

// Show window
function showContent(elem){
        hideContent();
	elem.find('.content').addClass('expanded');
	elem.addClass('cover');
}

// Reset all
function hideContent(){
	$('.menu .content').removeClass('expanded');
	$('.menu li').removeClass('cover');
}

// When a li is clicked, show its content window and position it above all
$('.menu li').click(function() {
	showContent($(this));
});

// When tabbing, show its content window using ENTER key
$('.menu li').keypress(function(e) {
	if (e.keyCode == 13) {
		showContent($(this));
	}
});

// When right upper close element is clicked  - reset all
$('.menu .close').click(function(e) {
	e.stopPropagation();
	hideContent();
});

// Also, when ESC key is pressed - reset all
$(document).keyup(function(e) {
	if (e.keyCode == 27) {
	  hideContent();
	}
});

})();
</pre>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-with-css3-jquery-window-expanded.png" alt="" title="Interactive menu with CSS3 &amp; jQuery - window expanded" width="600" height="380" class="aligncenter size-full wp-image-4549" /><br />
<em>Visible content window for the fifth element.</em></p>
<h3>Graceful degradation</h3>
<p>Regarding <code>opacity</code>, due its lack of support for older browsers, you&#8217;ll need to use the <code>display</code> toggleing for IE Trident:</p>
<pre class="prettyprint">
  opacity: 0; display: none\9; 	    /* Initially hidden */
  opacity: .95; display: block\9;   /* Expanded */
</pre>
<p>Other existing CSS3 stuff like transitions and gradients and just play nice where the support allows it.</p>
<h4>Selectors</h4>
<p>As you already noticed, we&#8217;ve used some CSS3 selectors that older browsers like <a href="http://www.red-team-design.com/how-to-solve-common-ie-bugs">IE8 and below</a> do not support.</p>
<p>So, we need a solution that fixes the example for those browsers. In my opinion, the best solution in this case is to use the <a href="http://selectivizr.com/">Selectivizr</a> tool, as we&#8217;ve already included jQuery in our project. That&#8217;s because Selectivzr requires one of those JavaScript libraries: jQuery, MooTools, Prototype etc. in order to work.</p>
<pre class="prettyprint">
&lt;!--[if (gte IE 6)&#038;(lte IE 8)]&gt;
	&lt;script src="selectivizr.js"&gt;&lt;/script&gt;
&lt;![endif]--&gt;
</pre>
<h3>Thoughts on accessibility</h3>
<p>The cool part is that along with HTML5, the <code>tabindex</code> attribute can be used on any HTML element. We&#8217;ll be using that in our example to enable tabbing navigation: <code>&lt;li tabindex="1"&gt;</code>.</p>
<p>I really wanted this example to be accessible via keyboard and I made it. When tabbing, you have the possibility to trigger a window by pressing the ENTER key and then close it by pressing the ESC key:</p>
<pre class="prettyprint">
// ENTER
$('.menu li').keypress(function(e) {
	if (e.keyCode == 13) {
		showContent($(this));
	}
});

// ESC
$(document).keyup(function(e) {
	if (e.keyCode == 27) {
	  hideContent();
	}
});
</pre>
<h3>That&#8217;s it!</h3>
<p>I hope you liked this article and I&#8217;m looking forward to read your thoughts about it. Thanks for reading!</p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-css3-jquery-demo.html">View demo</a><a class="download" href="http://www.red-team-design.com/wp-content/uploads/2012/04/interactive-menu-css3-jquery.zip">Download .zip</a></p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/iiY20Gs6jyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/interactive-menu-with-css3-jquery/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/interactive-menu-with-css3-jquery</feedburner:origLink></item>
		<item>
		<title>CSS Variables Preview</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/Li9P1s-6x1I/css-variables</link>
		<comments>http://www.red-team-design.com/css-variables#comments</comments>
		<pubDate>Wed, 11 Apr 2012 05:00:41 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[CSS4]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4453</guid>
		<description><![CDATA[If you are a developer then you are very familiar with variables and they are probably one of your best friends. A variable is by definition a temporary storage which contains some known or unknown quantity or information, a value. But, what is this having to do with the CSS we all know? The latest [...]]]></description>
			<content:encoded><![CDATA[<p>If you are a developer then you are very familiar with variables and they are probably one of your best friends. A variable is by definition a temporary storage which contains some known or unknown quantity or information, a value. </p>
<p>But, what is this having to do with the CSS we all know? The latest news is that the first working draft of <a href="http://www.w3.org/TR/css-variables/">CSS Variables</a> just got released.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/css-variables.jpg" alt="" title="CSS variables" width="600" height="200" class="aligncenter size-full wp-image-4472" /></p>
<p><span id="more-4453"></span></p>
<h3>Why CSS variables?</h3>
<p>Variables in CSS is something that people have been asking and wanting for a quite <a href="http://disruptive-innovations.com/zoo/cssvariables/">long time</a>. </p>
<p>Think about all those colors, heights, widths and sizes: will not be great to define them just once? After all, this is what we all want: <strong>write less &#038; do more</strong>.</p>
<h3>A CSS common practice</h3>
<p>When people asked about defining color variables in CSS, adding a comment at the top of the CSS file was sort of variable&#8217;s behavior simulation:</p>
<pre class="prettyprint">
/*--------------------------
link color: #99D1FF (light blue)
box color: #555 (dark gray)
--------------------------*/
</pre>
<p><em>Later, to update you&#8217;d need to search and replace content.</em></p>
<h3>The LESS/Sass ways to do it</h3>
<p>The idea of using variables for style sheets was one of those that have propelled <a href="http://lesscss.org/">LESS</a> or <a href="http://sass-lang.com/">Sass</a>.</p>
<h4>LESS</h4>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/less-variables.png" alt="" title="LESS variables" width="600" height="200" class="aligncenter size-full wp-image-4467" /></p>
<h4>Sass</h4>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/04/sass-variables.png" alt="" title="Sass variables" width="600" height="200" class="aligncenter size-full wp-image-4468" /></p>
<h3>How it will work</h3>
<p>First of all, please keep in mind that there&#8217;s no browser support actually. But this is how it will work: <strong>var-foo</strong> for definition, <strong>var(foo)</strong> for usage.</p>
<p>According to the draft:</p>
<blockquote><p>Any property name starting with the prefix &#8220;var-&#8221; is a variable property</p></blockquote>
<h4>Quick example</h4>
<p>The following rule declares a variable property named &#8220;var-header-color&#8221; on the root element, and assigns to it the value &#8220;#99D1FF&#8221;:</p>
<pre class="prettyprint">
:root {
  var-header-color: #99D1FF;
}
</pre>
<p>Further, its value can be referenced via the &#8220;header-color&#8221; variable:</p>
<pre class="prettyprint">
h1 {
  color: var(header-color);
}
</pre>
<p>Using color variables within gradient declarations can be very helpful too. You&#8217;d just need to replace values for the variables, and voila: all gradients updated. Sounds pretty cool if you ask me.</p>
<p>Also, when creating a layout, variables together with the <a href="http://www.w3.org/TR/css3-values/#calc0">calc()</a> function can help you making interesting calculations.</p>
<h3>Conclusion</h3>
<p>CSS is not a programming language and it neither shouldn&#8217;t be complicated too. Though, I think you agree that using CSS variables will be able to help you avoiding redundancy and creating more flexible style sheets. </p>
<p>Now, with the first module for CSS Variables release, we&#8217;re looking forward to seeing browsers implementing it in the near future.</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/Li9P1s-6x1I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/css-variables/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/css-variables</feedburner:origLink></item>
		<item>
		<title>CSS3 loading animation experiment</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/7A6eRVAR3vk/css3-loading-animation-experiment</link>
		<comments>http://www.red-team-design.com/css3-loading-animation-experiment#comments</comments>
		<pubDate>Mon, 26 Mar 2012 05:00:18 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4423</guid>
		<description><![CDATA[While playing DIRT 3, I&#8217;ve noticed a very cool triangle animation as part of their UI. Almost immediately, I thought about how to build a similar version of it using CSS3. So, in this article you&#8217;ll see an experiment about how to create a simple CSS3 loading animation. View demo For this example, I&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<p>While playing <a href="http://www.gamespot.com/dirt-3/" rel="nofollow">DIRT 3</a>, I&#8217;ve noticed a very cool triangle animation as part of their UI. Almost immediately, I thought about how to build a similar version of it using CSS3. </p>
<p>So, in this article you&#8217;ll see an experiment about how to create a simple CSS3 loading animation.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-loading-animation.png" alt="" title="CSS3 loading animation - experiment" width="600" height="200" class="aligncenter size-full wp-image-4432" /></p>
<p><span id="more-4423"></span></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-loading-animation-experiment-demo.html">View demo</a>
</p>
<p>For this example, I&#8217;ll be using two CSS3 animations: one that fades the color for the triangles and one animation that rotates the whole design. These two animations, synchronized, will help creating a quite nice effect.</p>
<h3>The HTML</h3>
<p>Initially, I wanted to use <a href="http://www.red-team-design.com/before-after-pseudo-elements">pseudo-elements</a> in order to have less markup elements. But, the thing is that generated content can&#8217;t be animated yet in other browsers than Mozilla Firefox.</p>
<p>Here&#8217;s how the markup looks like:</p>
<pre class="prettyprint">
&lt;div class="loading-wrap"&gt;
  &lt;div class="triangle1"&gt;&lt;/div&gt;
  &lt;div class="triangle2"&gt;&lt;/div&gt;
  &lt;div class="triangle3"&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<h3>The CSS</h3>
<p>There are some things you may find interesting here:</p>
<ul>
<li>For a nice color fade across all three triangles, you need to increment the animation-delay.</li>
<li>Notice the gap between <code>20%</code> and <code>100%</code> for the rotation keyframes. This helps adding a stop effect for the animation.</li>
</ul>
<pre class="prettyprint">
.loading-wrap {
  width: 60px; height: 60px;
  position: absolute;
  top: 50%; left: 50%;
  margin: -30px 0 0 -30px;
  background: #777;
  <mark>animation: rotation ease-in-out 2s infinite;</mark>
  border-radius: 30px;
}

.triangle1, .triangle2, .triangle3 {
  border-width: 0 20px 30px 20px;
  border-style: solid;
  border-color: transparent;
  border-bottom-color: #67cbf0;
  height: 0; width: 0;
  position: absolute;
  left: 10px; top: -10px;
  <mark>animation: fadecolor 2s 1s infinite;</mark>
}

.triangle2, .triangle3 {
  content: '';
  top: 20px; left: 30px;
  <mark>animation-delay: 1.1s;</mark>
}

.triangle3 {
  left: -10px;
  <mark>animation-delay: 1.2s;</mark>
}

@keyframes rotation {
    0% {transform: rotate(0deg);}
    20% {transform: rotate(360deg);}
    100% {transform: rotate(360deg);}
}

@keyframes fadecolor {
    0% {border-bottom-color: #eee;}
    100%{border-bottom-color: #67cbf0;}
}
</pre>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-loading-animation-experiment-demo.html">View demo</a>
</p>
<h3>Conclusion</h3>
<p>This is an experiment and you must be aware of it. For now, I think an animated GIF will do the job better in most of cases.</p>
<p>Also, this isn&#8217;t that example that advocates for using CSS3 stuff instead images to save HTTP requests. It is not applicable here as limited browser support for <a href="http://www.red-team-design.com/cool-notification-messages-with-css3-jquery">CSS3 animations</a> has something to say. Though, I hope you&#8217;ll find this example useful and inspiring for your future projects. </p>
<p>Thanks for reading and I&#8217;m looking forward to read your opinions!</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/7A6eRVAR3vk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/css3-loading-animation-experiment/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/css3-loading-animation-experiment</feedburner:origLink></item>
		<item>
		<title>CSS3 signup form</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/cJhoWIsvRvA/css3-signup-form</link>
		<comments>http://www.red-team-design.com/css3-signup-form#comments</comments>
		<pubDate>Mon, 12 Mar 2012 13:00:03 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[User experience]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4390</guid>
		<description><![CDATA[If you&#8217;re about to launch a new web product or you just need to improve the user experience for an existing web form, then this tutorial is for you. In this article you&#8217;ll find out how to design a clean and attractive CSS3 signup form. View demo In the past, I have designed some sign [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re about to launch a new web product or you just need to improve the user experience for an existing web form, then this tutorial is for you.</p>
<p>In this article you&#8217;ll find out how to design a clean and attractive CSS3 signup form.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-signup-form.png" alt="" title="CSS3 signup form" width="600" height="200" class="aligncenter size-full wp-image-4396" /></p>
<p><span id="more-4390"></span></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-signup-form-demo.html">View demo</a>
</p>
<p>In the past, I have designed some <a href="http://www.red-team-design.com/slick-login-form-with-html5-css3">sign in</a> <a href="http://www.red-team-design.com/simple-and-effective-dropdown-login-box">forms</a>, but never a signup form. So, to get the job completely done, I decided to write this article.</p>
<h3>The HTML</h3>
<p>Here&#8217;s how the markup looks like for this signup form:</p>
<pre class="prettyprint">
&lt;form id="signup"&gt;
	&lt;h1&gt;Start doing cool stuff in seconds.&lt;/h1&gt;
	&lt;input type="email" placeholder="john.doe@email.com" required=""&gt;
	&lt;input type="password" placeholder="Choose your password" required=""&gt;
	&lt;input type="password" placeholder="Confirm password" required=""&gt;
	&lt;button type="submit"&gt;Sign up for free!&lt;/button&gt;
&lt;/form&gt;
</pre>
<p>For this example, I decided to use a <code>buttton</code> instead of the classic <code>input type="submit"</code>. This way, further, it will be a lot easier to target the form&#8217;s elements (without adding any id&#8217;s or classes).</p>
<h4>Placeholder polyfill</h4>
<p>You can easily notice the new HTML5 stuff like <code>type="email"</code>, <code>placeholder</code> or <code>required</code>. For the placeholder attribute, we&#8217;ll add a <a href="https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills" target="_blank">HTML5 polyfill</a> that will simulate its effect for older browsers.</p>
<p>In this example, we&#8217;ll be using <a href="http://mathiasbynens.be/" target="_blank">Mathias Bynens</a>&#8216;s <a href="https://github.com/mathiasbynens/jquery-placeholder" target="_blank">Placeholder jQuery plugin</a>. That&#8217;s a very cool one and it&#8217;s highly recommended.</p>
<h3>The CSS</h3>
<p>As usual, I&#8217;ll list below the styles used for this example. Prefixed properties are missing here, but you can find them in the demo page source.</p>
<h4>Form styles</h4>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-signup-form-background.png" alt="" title="CSS3 signup form - background" width="600" height="400" class="aligncenter size-full wp-image-4409" /></p>
<p>After I created a simple <code>3x4</code> image pattern, I converted it into a base64 string. To do that, I used this wonderful <a href="http://webcodertools.com/imagetobase64converter" target="_blank">Image to Base64 Converter tool</a>. You can see it in the styles as a background for <code>#signup</code>.</p>
<p>Regarding the <a href="http://www.red-team-design.com/slick-login-form-with-html5-css3" target="_blank">paper stack effect</a>, this time we&#8217;re using the <code>::before</code> and <code>::after</code> <code>pseudo-elements</code> to do that. <a href="http://www.red-team-design.com/just-another-css3-menu" target="_blank">Here</a>&#8216;s one of my previous articles where I used a similar technique. </p>
<pre class="prettyprint">
#signup {
	width: 550px;
	height: 330px;
	margin: 100px auto 50px auto;
	padding: 20px;
	position: relative;
	background: #fff url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAECAMAAAB883U1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRF7+/v7u7u////REBVnAAAAAN0Uk5T//8A18oNQQAAABZJREFUeNpiYGJiYmBiYgRiBhAGCDAAALsAFJhiJ+UAAAAASUVORK5CYII=);
	border: 1px solid #ccc;
	border-radius: 3px;
}

#signup::before,
#signup::after {
	content: "";
	position: absolute;
	bottom: -3px;
	left: 2px;
	right: 2px;
	top: 0;
	z-index: -1;
	background: #fff;
	border: 1px solid #ccc;
}

#signup::after {
	left: 4px;
	right: 4px;
	bottom: -5px;
	z-index: -2;
	box-shadow: 0 8px 8px -5px rgba(0,0,0,.3);
}
</pre>
<h4>Heading</h4>
<p>I tried to create a nice and abstract design for the form&#8217;s heading, so here&#8217;s my result:</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-signup-form-heading.png" alt="" title="CSS3 signup form - heading" width="600" height="200" class="aligncenter size-full wp-image-4411" /></p>
<pre class="prettyprint">
#signup h1 {
	position: relative;
	font: italic 1em/3.5em 'trebuchet MS',Arial, Helvetica;
	color: #999;
	text-align: center;
	margin: 0 0 20px;
}

#signup h1::before,
#signup h1::after{
	content:'';
	position: absolute;
	border: 1px solid rgba(0,0,0,.15);
	top: 10px;
	bottom: 10px;
	left: 0;
	right: 0;
}

#signup h1::after{
	top: 0;
	bottom: 0;
	left: 10px;
	right: 10px;
}
</pre>
<p><em>Using pseudo-elements (again) :)</em></p>
<h4>Form elements</h4>
<p>Not so much to say here. For the submit button, please notice the <a href="http://www.red-team-design.com/css-pitfalls-and-how-to-overcome-them" target="_blank">gradient transition workaround</a>.</p>
<pre class="prettyprint">
::-webkit-input-placeholder {
   color: #bbb;
}

:-moz-placeholder {
   color: #bbb;
} 				    	

.placeholder{
	color: #bbb; /* polyfill */
}		

#signup input{
	margin: 5px 0;
	padding: 15px;
	width: 100%;
	*width: 518px; /* IE7 and below */
	box-sizing: border-box;
	border: 1px solid #ccc;
	border-radius: 3px;
}

#signup input:focus{
        outline: 0;
        border-color: #aaa;
	box-shadow: 0 2px 1px rgba(0, 0, 0, .3) inset;
}		

#signup button{
	margin: 20px 0 0 0;
	padding: 15px 8px;
	width: 100%;
	cursor: pointer;
	border: 1px solid #2493FF;
	overflow: visible;
	display: inline-block;
	color: #fff;
	font: bold 1.4em arial, helvetica;
	text-shadow: 0 -1px 0 rgba(0,0,0,.4);
	background-color: #2493ff;
	background-image: linear-gradient(top, rgba(255,255,255,.5), rgba(255,255,255,0));
	transition: background-color .2s ease-out;
	border-radius: 3px;
	box-shadow: 0 2px 1px rgba(0, 0, 0, .3), 0 1px 0 rgba(255, 255, 255, .5) inset;
}

#signup button:hover{
  	background-color: #7cbfff;
        border-color: #7cbfff;
}

#signup button:active{
	position: relative;
	top: 3px;
	text-shadow: none;
	box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset;
}
</pre>
<h3>That&#8217;s it!</h3>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-signup-form-final.png" alt="" title="CSS3 signup form - final" width="600" height="400" class="aligncenter size-full wp-image-4412" /></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/03/css3-signup-form-demo.html">View demo</a>
</p>
<p>I&#8217;m aware that this example does not contain revolutionary techniques, but neither shouldn&#8217;t. The possibilities are endless when it comes about web forms styling, as long as you follow up the best and recommended practices.</p>
<p>This is just another cool example created using CSS3&#8242;s great power. I hope you will find it useful for your projects, and please don&#8217;t forget to leave a comment if you liked it (or not). :)</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/cJhoWIsvRvA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/css3-signup-form/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/css3-signup-form</feedburner:origLink></item>
		<item>
		<title>CSS pitfalls and how to overcome them</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/2nUp8_dwyXw/css-pitfalls-and-how-to-overcome-them</link>
		<comments>http://www.red-team-design.com/css-pitfalls-and-how-to-overcome-them#comments</comments>
		<pubDate>Wed, 29 Feb 2012 06:00:04 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4187</guid>
		<description><![CDATA[When you write CSS, there are some problems you may run into. Then, to overcome the situation, you&#8217;ll need to use some small and effective CSS tricks. In this article I&#8217;ll try to show you some tips and tricks that can definitely help you when writing CSS. Buttons styling I&#8217;ll begin with classical HTML buttons. [...]]]></description>
			<content:encoded><![CDATA[<p>When you write CSS, there are some problems you may run into. Then, to overcome the situation, you&#8217;ll need to use some small and effective CSS tricks.</p>
<p>In this article I&#8217;ll try to show you some tips and tricks that can definitely help you when writing CSS.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/css-pitfalls-and-how-to-overcome-them.png" alt="" title="CSS pitfalls and how to overcome them" width="600" height="200" class="aligncenter size-full wp-image-4377" /></p>
<p><span id="more-4187"></span></p>
<h3>Buttons styling</h3>
<p>I&#8217;ll begin with classical HTML buttons. When trying to style buttons like <code>input type"submit"</code> or <code>button</code>, if you want to achieve <em>pixel perfection</em> in your designs, don&#8217;t forget about the following:</p>
<pre class="prettyprint">
/* removes extra side spacing in IE */
.button{
  overflow: visible;
}

/* removes extra inner spacing in Firefox */
.button::-moz-focus-inner{
  border: 0;
  padding: 0;
}
</pre>
<p>Want to see some buttons that are using the above snippet?</p>
<ul>
<li><a href="http://www.red-team-design.com/just-another-awesome-css3-buttons">Just some other awesome CSS3 buttons</a></li>
<li><a href="http://www.red-team-design.com/design-a-beautiful-css3-search-form">Design a beautiful CSS3 search form</a></li>
<li><a href="http://www.red-team-design.com/how-to-create-a-cool-and-usable-css3-search-box">Cool CSS3 search box</a></li>
</ul>
<h3>Using pseudo-elements</h3>
<p>I&#8217;m sure you already know that using pseudo-elements like <code>:before</code> and <code>:after</code> helps you specifying which content should be inserted before (or after) the content of that element. Besides that, elements like <code>input</code> or <code>img</code> have no content, therefore, the pseudo-elements will not render anything for them. An <strong>exception</strong> is the <code>hr</code> element, which, for some reason, allows adding pseudo-elements to it. </p>
<p>Also, keep in mind the <a href="http://www.red-team-design.com/before-after-pseudo-elements">difference</a> between <code>:before</code> and <code>::before</code>. To summarize it, IE8 is the only reason to use the single colon syntax. </p>
<h3>Gradient background for whole body</h3>
<p>If you tried before to add a <a href="http://www.red-team-design.com/css-gradients-quick-tutorial">CSS3 gradient</a> for your <code>body</code>, then you noticed that it will not stretch and it will repeat instead. To fix that, just add the following lines:</p>
<pre class="prettyprint">
html {
    height: 100%;
}
body {
    height: 100%;
    margin: 0;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
</pre>
<h3>Fake transitions on gradients</h3>
<p>Speaking of gradients, want transitions for CSS3 gradients? Unfortunately, there&#8217;s no browser support for gradients transitions (yet). </p>
<p>But, this can be done using some tricks like:</p>
<ul>
<li>Use <code>background-position</code> on <code>:hover</code> to give the illusion that the gradient is transitioning. Actually, it&#8217;s shifted using the Y-axis only. This technique is used by <a href="http://twitter.github.com/bootstrap/">Twitter&#8217;s Bootstrap</a>.
<pre class="prettyprint">
a{
    background: linear-gradient(orange, red) repeat-x;
    display: inline-block;
    padding: 20px;
}

a:hover{
    background-color: red;
    background-position: 0 -15px;
    transition: background-position .1s linear;
}
</pre>
</li>
<li>The second option (and my favorite) is to transition the <code>background-color</code> and apply a gradient image to it which fades to transparent value. Again, this gives the illusion of an transitioning gradient.
<pre class="prettyprint">
a{
    background-color: orangered;
    background-image: linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));
    transition: background-color .1s linear;
    display: inline-block;
    padding: 20px;
}

a:hover{
  background-color: red;
}
</pre>
</li>
</ul>
<h3>Inline-block gaps</h3>
<p>Let&#8217;s say you&#8217;d like to use <code>inline-block</code> instead <code>float</code> for a horizontal list. When doing that, a horizontal space will appear between your <code>inline-block</code> elements. To avoid that, you&#8217;ll need to use a <em>dirty</em> (also good) method, namely adjust your markup.</p>
<p>So, instead using a clean structure like the below one:</p>
<pre class="prettyprint">
&lt;ul&gt;
	&lt;li&gt;one&lt;/li&gt;
	&lt;li&gt;two&lt;/li&gt;
	&lt;li&gt;three&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>you&#8217;ll have to use something like this:</p>
<pre class="prettyprint">
&lt;ul&gt;
	&lt;li&gt;one&lt;/li&gt;&lt;li&gt;two&lt;/li&gt;&lt;li&gt;three&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>Read more about the CSS display <code>inline-block</code> value: <a href="http://robertnyman.com/2010/02/24/css-display-inline-block-why-it-rocks-and-why-it-sucks/">Why it rocks, and why it sucks</a>.</p>
<h3>When height 100% actually works?</h3>
<p>It&#8217;s actually quite simple: when you set a <code>height: 100%</code> for an element, always think about the parent&#8217;s height. If the parent&#8217;s height is not defined in your styles, then the inner element will have height: 100% of <em>nothing</em>.</p>
<p>Please consider the following <strong>working</strong> (and rough) example:</p>
<pre class="prettyprint">
&lt;div id="parent"&gt;
    &lt;div id="child"&gt;2&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>and</p>
<pre class="prettyprint">
#parent{
    height: 400px;
    padding:10px;
    background:red;
}

#child{
    height: 100%;
    background:green;
}
</pre>
<p>In the above example, the green colored <code>#child</code>, using <code>height: 100%</code>, will stretch and fill the whole <code>400px</code> vertical space. Also, you can check my <a href="http://www.red-team-design.com/stylish-css3-progress-bars">CSS3 progress bars</a> for a live example of the above trick.</p>
<h3>Rounded corners for tables</h3>
<p>The trick consist of setting the table&#8217;s <code>border-spacing</code> to <code>0</code>. The <code>border-collapse</code>‘s default value is <code>separate</code>, you&#8217;ll only need to set it to <code>collapse</code> for IE7 and lower ( for a graceful degradation).</p>
<pre class="prettyprint">
table {
    *border-collapse: collapse; /* IE7 and lower */
    border-spacing: 0;
    border-radius: 5px;
}
</pre>
<p>Check my <a href="http://www.red-team-design.com/practical-css3-tables-with-rounded-corners">CSS3 tables with rounded corners</a> article to read more about it.</p>
<h3>Inputs box model</h3>
<p>When designing a search box, for example, you&#8217;ll notice that after setting the same <code>height</code> or <code>width</code> for your <code>input type="submit"</code> and <code>input type="text"</code>, the result will most likely disappoint you.</p>
<p>Quite frustrating, but the thing is that <code>input type="submit"</code> has a <code>border-box</code> box model, while <code>input type="text"</code> has a <code>content-box</code> box model (on IE and FF). </p>
<p>To overcome this kind of of issue, you can set for both form&#8217;s inputs (text and submit) the same box sizing model. This can be done using CSS3 <code>box-sizing</code>:</p>
<pre class="prettyprint">
      box-sizing: content-box | padding-box | border-box;
</pre>
<h3>Conclusion</h3>
<p>The above are just some tricks I often use when writing CSS. I found them very useful, and I sincerely wish I knew them at the beginning. </p>
<p>I hope you enjoyed these and feel free to share yours by adding a comment below. Thank you for reading!</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/2nUp8_dwyXw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/css-pitfalls-and-how-to-overcome-them/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/css-pitfalls-and-how-to-overcome-them</feedburner:origLink></item>
		<item>
		<title>Fancy FAQ page using CSS3 only</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/R22Cd9GS0wI/fancy-faq-page-using-css3-only</link>
		<comments>http://www.red-team-design.com/fancy-faq-page-using-css3-only#comments</comments>
		<pubDate>Mon, 20 Feb 2012 06:00:16 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=4298</guid>
		<description><![CDATA[Usually, a FAQ page is that long page with lots of questions and answers, the one we are searching for when we need some extra info regarding a subject. So, for example, if you own a website that sells stuff, then you will need a page like that. In this article I&#8217;ll show you how [...]]]></description>
			<content:encoded><![CDATA[<p>Usually, a FAQ page is that long page with lots of questions and answers, the one we are searching for when we need some extra info regarding a subject. So, for example, if you own a website that sells stuff, then you will need a page like that.</p>
<p>In this article I&#8217;ll show you how to create a fancy FAQ page using CSS3 only, no JavaScript.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-faq-page.png" alt="" title="Fancy FAQ page using CSS3 only - preview" width="600" height="200" class="aligncenter size-full wp-image-4308" /></p>
<p><span id="more-4298"></span></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/02/fancy-faq-page-using-css3-only-demo.html">View demo</a>
</p>
<h3>The idea</h3>
<p>When I visited Facebook&#8217;s <a href="https://www.facebook.com/help/privacy/sharing-choices" title="Facebook's Help Center " target="_blank">Help Center</a> section (theirs FAQ&#8217;s), I noticed a cool effect for the answers previews. They show a small, faded and clipped text preview for the answer, and then, when the question is clicked, the complete answer is revealed.</p>
<p>After seeing it, of course I immediately thought about how can I create a similar effect using CSS3 only. So, further you&#8217;ll see how I made it.</p>
<h3>The HTML</h3>
<p>We will start as usual with the markup structure:</p>
<pre class="prettyprint">
&lt;section class="faq-section"&gt;
    &lt;input type="checkbox" id="q1"&gt;
    &lt;label for="q1"&gt;Question?&lt;/label&gt;
    &lt;p&gt;... The intro paragraph that will be clipped ...&lt;/p&gt;
    &lt;p&gt;... Extra and optional paragraph ...&lt;/p&gt;
&lt;/section&gt;
</pre>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/fancy-faq-page-using-css3-only-markup.png" alt="" title="Fancy FAQ page using CSS3 only - markup" width="600" height="200" class="aligncenter size-full wp-image-4319" /></p>
<ul>
<li>In the above image, the label is the proper heading of the section. But, if you want to use better semantic, you can wrap the <code>label</code> into a <code>h1</code>.</li>
<li>Using <code>label::before</code> allow us to create the right triangle shape. On a side note, double colon for <a href="http://www.red-team-design.com/before-after-pseudo-elements">pseudo-elements</a> is the CSS3 way.</li>
<li>The first paragraph for each section is the intro preview for the complete answer. For this example, I used the <a href="http://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators">adjacent sibling combinator</a> to target it.</li>
</ul>
<h4>How it works?</h4>
<p>There&#8217;s no rocket science here. The technique we will use today is called <em>the checkbox hack</em> and it relies on the ability of <a href="http://www.red-team-design.com/web-usability-tips-for-your-website">toggle-ing</a> an <code>&lt;input type="checkbox" id="abc"&gt;</code> using the <code>&lt;label for="abc"&gt;</code>. Also, in the same time, the checkbox input will be hidden.</p>
<p>I played before with this cool technique, but never had the opportunity to create a practical example actually. So, this is my shot! :)</p>
<p>If you want to read more about this technique, Chris Coyier wrote a while ago an article where he shows some cool stuff you can do with <a href="http://css-tricks.com/the-checkbox-hack/">the checkbox hack</a>.</p>
<h3>The CSS</h3>
<p>Below you have the styles, I commented some lines for a better understanding:</p>
<pre class="prettyprint">
/*Add some spacing*/
.faq-section{
	margin: 40px 0;
        position: relative;
}

/*Hide the paragraphs*/
.faq-section p{
	display: none;
}	

/*Hide the checkboxes */
.faq-section input{
	position: absolute;
	z-index: 2;
	cursor: pointer;
	opacity: 0;
	display: none\9; /* IE8 and below */
	margin: 0;
	width: 100%;
	height: 36px;
}

/*Show only the clipped intro */
.faq-section label+p{
	display: block;
	color: #999;
	font-size: .85em;
	transition: all .15s ease-out;
	/* Clipping text */
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

/*If the checkbox is checked, show all paragraphs*/
.faq-section input[type=checkbox]:checked~p{
	display: block;
	color: #444;
	font-size: 1em;
	/* restore clipping defaults */
	text-overflow: clip;
	white-space: normal;
	overflow: visible;
}

/*Style the label*/
.faq-section label{
	font-size: 1.2em;
	background: #eee;
	display: block;
	position: relative;
        height: 20px;
	padding: 7px 10px;
	font-weight: bold;
	border: 1px solid #ddd;
	border-left: 3px solid #888;
	text-shadow: 0 1px 0 rgba(255,255,255,.5);
	transition: all .15s ease-out;
}

/*Remove text selection when toggle-ing*/
.faq-section label::selection{
	background: none;
}

.faq-section label:hover{
	background: #f5f5f5;
}

/*If the checkbox is checked, style the label accordingly*/
.faq-section input[type=checkbox]:checked~label{
	border-color: #ff7f50;
	background: #f5deb4;
	background-image: linear-gradient(to bottom, #fff, #f5deb4);
	box-shadow: 0 0 1px rgba(0,0,0,.4);
}

/*Label's arrow - default state */
.faq-section label::before{
	content: '';
	position: absolute;
	right: 4px;
	top: 50%;
	margin-top: -6px;
	border: 6px solid transparent;
	border-left-color: inherit;
}

/*Update the right arrow*/
.faq-section input[type=checkbox]:checked~label::before{
	border: 6px solid transparent;
	border-top-color: inherit;
	margin-top: -3px;
	right: 10px;
}
</pre>
<h3>Browser support</h3>
<p>What about the older browsers? That&#8217;s a normal question, and the answer is <strong>graceful degradation</strong>:</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/fancy-faq-page-graceful-degradation.png" alt="" title="Fancy FAQ page - graceful degradation" width="600" height="200" class="aligncenter size-full wp-image-4321" /></p>
<p>Using the following snippet, we&#8217;re targeting browsers like <a href="http://www.red-team-design.com/how-to-solve-common-ie-bugs">IE8 and below</a>. So, we&#8217;ll enable the HTML5 elements like <code>section</code> and then add some custom styles in order to keep the FAQ&#8217;s content readable.</p>
<pre class="prettyprint">
&lt;!--[if lt IE 9]&gt;
    &lt;script src="http://html5shim.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;
    &lt;style&gt;
		.faq-section label,
		.faq-section label:hover{
			cursor: default;
			background: #eee;
		}
		body .faq-section p{ /* Increase specificity */
			display: block;
			color: #444;
			font-size: 1em;
			text-overflow: clip;
			white-space: normal;
			overflow: visible;
		}
    &lt;/style&gt;
&lt;![endif]--&gt;
</pre>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/02/fancy-faq-page-using-css3-only-demo.html">View demo</a>
</p>
<h3>Update: i0S support</h3>
<p>You asked for it, now you have it: iOS browser support. I had some time to think about it and I made updates regarding hiding the checkbox.</p>
<p>Here&#8217;s my fix, <strong>tested on iPhone and iPad</strong> using the <strong>latest iOS versions</strong>:</p>
<pre class="prettyprint">
.faq-section input{
	position: absolute;
	z-index: 2;
	cursor: pointer;
	opacity: 0;
	display: none\9; /* IE8 and below */
	margin: 0;
	width: 100%;
	height: 36px;
}
</pre>
<ul>
<li><code>position: absolute</code> &#8211; While <code>.faq-section</code> wrapper is relative positioned, we&#8217;ll need this to visually place our checkbox above the label.</li>
<li><code>z-index: 2</code> &#8211; Make sure it will be above section content, including label.</li>
<li><code>cursor: pointer</code> &#8211; Optionally, this will add a pointer cursor when you hover on it.</li>
<li><code>opacity: 0</code> and <code>display: none\9</code> &#8211; Visually hide the checbox, while on browsers like Internet Explorer 8 and below will be hidden.</li>
<li><code>margin: 0</code> &#8211; Remove default margin.</li>
<li><code>width: 100%</code> and <code>height: 36px</code> &#8211; The checkbox height value matches the height of the label. Also, using 100% for the width will expand the checbox in order to fully cover the label.</li>
</ul>
<h3>Done!</h3>
<p>That&#8217;s all, I hope you liked this article. Please feel free to comment and share your thoughts/ideas about the result.</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/R22Cd9GS0wI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/fancy-faq-page-using-css3-only/feed</wfw:commentRss>
		<slash:comments>24</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/fancy-faq-page-using-css3-only</feedburner:origLink></item>
		<item>
		<title>CSS3 ordered list styles</title>
		<link>http://feedproxy.google.com/~r/redteamdesign/~3/mzkapGi6pWQ/css3-ordered-list-styles</link>
		<comments>http://www.red-team-design.com/css3-ordered-list-styles#comments</comments>
		<pubDate>Mon, 13 Feb 2012 06:00:59 +0000</pubDate>
		<dc:creator>Catalin Rosu</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://www.red-team-design.com/?p=3706</guid>
		<description><![CDATA[Styling ordered lists was always a tricky task and I&#8217;m not the only one who thinks that. To style numbers you need to remove default browser styles and add hooks to your lists elements in order to target them and style accordingly. In this article you&#8217;ll learn how to add some CSS3 fine tuning to [...]]]></description>
			<content:encoded><![CDATA[<p>Styling ordered lists was always a tricky task and I&#8217;m not the only one who thinks that. To style numbers you need to remove default browser styles and add hooks to your lists elements in order to target them and style accordingly.</p>
<p>In this article you&#8217;ll learn how to add some CSS3 fine tuning to your ordered lists, using a semantic approach.</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-ordered-list-styles.png" alt="" title="CSS3 ordered lists styles" width="600" height="200" class="aligncenter size-full wp-image-4271" /></p>
<p><span id="more-3706"></span></p>
<h3>The idea</h3>
<p>When I first read Roger Johansson&#8217;s <a href="http://www.456bereastreet.com/archive/201105/styling_ordered_list_numbers/">article</a> about styling ordered list numbers, I must admit I seriously felt in love with that technique. Using that technique, I will try to go a bit further and show you two different styling possibilities for ordered lists.</p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-ordered-list-styles-demo.html">View demo</a>
</p>
<h3>The HTML</h3>
<p>Below you&#8217;ll find nothing than simple ordered list markup:</p>
<pre class="prettyprint">
&lt;ol class="rounded-list"&gt;
	&lt;li&gt;&lt;a href=""&gt;List item&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=""&gt;List item&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=""&gt;List item&lt;/a&gt;
		&lt;ol&gt;
			&lt;li&gt;&lt;a href=""&gt;List sub item&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=""&gt;List sub item&lt;/a&gt;&lt;/li&gt;
			&lt;li&gt;&lt;a href=""&gt;List sub item&lt;/a&gt;&lt;/li&gt;
		&lt;/ol&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;a href=""&gt;List item&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=""&gt;List item&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</pre>
<h3>The CSS</h3>
<p>Further, I&#8217;ll try to explain how this works in a few words.</p>
<p>This technique uses <a href="http://www.w3.org/TR/CSS21/generate.html#counters">Automatic counters and numbering</a>. Basically it&#8217;s about using two CSS 2.1 properties: <code>counter-reset</code> (this initiate a counter) and <code>counter-increment</code> (kinda self-explanatory, this increments the previous counter). As you will see below, the <code>counter-increment</code> will be used along with CSS generated content (<a href="http://www.red-team-design.com/before-after-pseudo-elements">pseudo-elements</a>).</p>
<pre class="prettyprint">
ol{
	<mark>counter-reset: li; /* Initiate a counter */</mark>
	list-style: none; /* Remove default numbering */
	*list-style: decimal; /* Keep using default numbering for IE6/7 */
	font: 15px 'trebuchet MS', 'lucida sans';
	padding: 0;
	margin-bottom: 4em;
	text-shadow: 0 1px 0 rgba(255,255,255,.5);
}

ol ol{
	margin: 0 0 0 2em; /* Add some left margin for inner lists */
}
</pre>
<h4>Rounded-shaped numbers</h4>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-ordered-list-rounded.png" alt="" title="CSS3 ordered list - rounded-shaped" width="600" height="200" class="aligncenter size-full wp-image-4290" /></p>
<pre class="prettyprint">
.rounded-list a{
	position: relative;
	display: block;
	padding: .4em .4em .4em 2em;
	*padding: .4em;
	margin: .5em 0;
	background: #ddd;
	color: #444;
	text-decoration: none;
	border-radius: .3em;
	transition: all .3s ease-out;
}

.rounded-list a:hover{
	background: #eee;
}

.rounded-list a:hover:before{
    transform: rotate(360deg);
}

.rounded-list a:before{
	<mark>content: counter(li);</mark>
	<mark>counter-increment: li;</mark>
	position: absolute;
	left: -1.3em;
	top: 50%;
	margin-top: -1.3em;
	background: #87ceeb;
	height: 2em;
	width: 2em;
	line-height: 2em;
	border: .3em solid #fff;
	text-align: center;
	font-weight: bold;
	border-radius: 2em;
	transition: all .3s ease-out;
}
</pre>
<h4>Rectangle-shaped numbers</h4>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-ordered-list-rectangle.png" alt="" title="CSS3 ordered list - rectangle-shaped" width="600" height="200" class="aligncenter size-full wp-image-4291" /></p>
<pre class="prettyprint">
.rectangle-list a{
	position: relative;
	display: block;
	padding: .4em .4em .4em .8em;
	*padding: .4em;
	margin: .5em 0 .5em 2.5em;
	background: #ddd;
	color: #444;
	text-decoration: none;
	transition: all .3s ease-out;
}

.rectangle-list a:hover{
	background: #eee;
}	

.rectangle-list a:before{
	<mark>content: counter(li);</mark>
	<mark>counter-increment: li;</mark>
	position: absolute;
	left: -2.5em;
	top: 50%;
	margin-top: -1em;
	background: #fa8072;
	height: 2em;
	width: 2em;
	line-height: 2em;
	text-align: center;
	font-weight: bold;
}

.rectangle-list a:after{
	position: absolute;
	content: '';
	border: .5em solid transparent;
	left: -1em;
	top: 50%;
	margin-top: -.5em;
	transition: all .3s ease-out;
}

.rectangle-list a:hover:after{
	left: -.5em;
	border-left-color: #fa8072;
}
</pre>
<h4>Circle-shaped numbers</h4>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-ordered-list-circle.png" alt="" title="CSS3 ordered list - circle" width="600" height="200" class="aligncenter size-full wp-image-4387" /></p>
<pre class="prettyprint">
.circle-list li{
    padding: 2.5em;
    border-bottom: 1px dashed #ccc;
}

.circle-list h2{
    position: relative;
    margin: 0;
}

.circle-list p{
    margin: 0;
}

.circle-list h2:before{
    content: counter(li);
    counter-increment: li;
    position: absolute;
    z-index: -1;
    left: -1.3em;
    top: -.8em;
    background: #f5f5f5;
    height: 1.5em;
    width: 1.5em;
    border: .1em solid rgba(0,0,0,.05);
    text-align: center;
    font: italic bold 1em/1.5em Georgia, Serif;
    color: #ccc;
    border-radius: 1.5em;
    transition: all .2s ease-out;
}

.circle-list li:hover h2:before{
    background-color: #ffd797;
    border-color: rgba(0,0,0,.08);
    border-width: .2em;
    color: #444;
    transform: scale(1.5);
}
</pre>
<h4>Small bonus</h4>
<p>Some CSS3 numbers animations are also included in this demo. Unfortunately, as far as I know and at this time, Firefox is the only one who supports animated pseudo-elements. Let&#8217;s hope that will <a href="http://code.google.com/p/chromium/issues/detail?id=54699">improve</a> sooner or later.</p>
<h3>Browser support</h3>
<p>These list looks well also on older browsers, as you can see below:</p>
<p><img src="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-ordered-list-browser-support.png" alt="" title="CSS3 ordered list - browser-support" width="600" height="200" class="aligncenter size-full wp-image-4292" /></p>
<p class="center buttons-para">
<a class="demo" href="http://www.red-team-design.com/wp-content/uploads/2012/02/css3-ordered-list-styles-demo.html">View demo</a>
</p>
<h3>That&#8217;s all!</h3>
<p>Thank you all for reading and I hope you enjoyed it. Feel free to share your thoughts, I appreciate your comments.</p>
<img src="http://feeds.feedburner.com/~r/redteamdesign/~4/mzkapGi6pWQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.red-team-design.com/css3-ordered-list-styles/feed</wfw:commentRss>
		<slash:comments>35</slash:comments>
		<feedburner:origLink>http://www.red-team-design.com/css3-ordered-list-styles</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/37 queries in 0.038 seconds using disk: basic
Object Caching 916/996 objects using disk: basic

Served from: www.red-team-design.com @ 2012-05-28 14:14:56 -->

