<?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>tobypitman.com &#187; CSS</title>
	<atom:link href="http://www.tobypitman.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tobypitman.com</link>
	<description>Official website of guitarist Toby Pitman</description>
	<lastBuildDate>Thu, 24 Jun 2010 14:24:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iPhone Style Checkboxes With CSS3</title>
		<link>http://www.tobypitman.com/iphone-style-checkboxes-with-css3/</link>
		<comments>http://www.tobypitman.com/iphone-style-checkboxes-with-css3/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 16:44:49 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=355</guid>
		<description><![CDATA[Here's some form input checkboxes styled with CSS3 to look like iPhone style on/off buttons.]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-357" title="iphone-checkboxes" src="http://www.tobypitman.com/wp-content/uploads/2010/06/iphone-checkboxes.png" alt="" width="590" height="267" /></p>
<p>Here&#8217;s some form input checkboxes styled with CSS3 to look like iPhone style on/off buttons. Just messing about again with CSS3.</p>
<p>It&#8217;s all done with an input &#8216;checkbox&#8217; an a couple of labels. There&#8217;s no javascript to add any classes and the on/off text is added using the :before and :after pseudo classes in CSS with generated content, there are also no images used. It should work cross browser although I haven&#8217;t tested IE and Opera. Shoudn&#8217;t take too much tweaking if you want to try, I just didn&#8217;t have time.</p>
<p>There&#8217;s some -webkit- animations for Chrome and Safari. The clever bit is using the label to switch the checkbox off and on using the &#8216;for&#8217; attribute whick targets the &#8216;id&#8217; of the checkbox. Like this:</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;input id=&quot;1&quot; checked=&quot;checked&quot; name=&quot;1&quot; type=&quot;checkbox&quot; value=&quot;1&quot; /&gt;<br />
&lt;label class=&quot;check&quot; for=&quot;1&quot;&gt;&lt;/label&gt;</div></div>
</pre>
<p>The label is then styled to have a different position using :checked. The checkbox itself is hidden.</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">input[type=checkbox]:checked + label.check {<br />
&nbsp; &nbsp; top: 0px;<br />
&nbsp; &nbsp; left: 38px;<br />
}</div></div>
</pre>
<p>This CSS looks at any checkbox that&#8217;s &#8216;checked&#8217; and moves the next available label element with a class of &#8216;check&#8217; 38px left. Pretty cool!! Check out the source for more detail! <img src='http://www.tobypitman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="viewdemo" href="http://development.tobypitman.com/iphoneCheckboxes/iphoneCheckboxes2.html">View Demo</a></p>
<p>Ironically this doesn&#8217;t work on the iPhone!!?</p>
<p>P.S. This &#8216;experiment&#8217; wasn&#8217;t intended to simulate any kind of &#8216;drag&#8217; feature on the iPhone, it was just a try at making a pretty looking checkbox. It&#8217;s not a radiobox either, although you could probably use it for that too! All I was interested in was the CSS and just seeing if it was possible to achieve this kind of interface design without lots of extra bulky markup or JS. Sorry for any confusion or offence caused. <img src='http://www.tobypitman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Update: Here&#8217;s a UI example that doesn&#8217;t look like the iPhone buttons. Maybe this is a bit clearer as to how it may be used.</p>
<p><img class="aligncenter size-full wp-image-373" title="preview2" src="http://www.tobypitman.com/wp-content/uploads/2010/06/preview21.png" alt="" width="590" height="418" /></p>
<p><a class="viewdemo" href="http://development.tobypitman.com/iphoneCheckboxes/settings.html">View  Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/iphone-style-checkboxes-with-css3/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>CSS3 Scrolling Header Image</title>
		<link>http://www.tobypitman.com/css3-scrolling-header-image/</link>
		<comments>http://www.tobypitman.com/css3-scrolling-header-image/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 22:00:03 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=342</guid>
		<description><![CDATA[Here's a cool thing you can do with the CSS3 animations behaviour. An infinitely scrollling header image!!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tobypitman.com/wp-content/uploads/2010/06/clouds.png"><img class="aligncenter size-full wp-image-343" title="clouds" src="http://www.tobypitman.com/wp-content/uploads/2010/06/clouds.png" alt="" width="590" height="208" /></a></p>
<p>Here&#8217;s a cool thing you can do with the CSS3 animations behaviour. An infinitely scrollling header image!!</p>
<p>Take an image exactly 3 times the height of your header (make sure it tiles!! I use the &#8216;offset&#8217; plugin in Photoshop ) and assign it to the background of the header. In this example my image is 450px high.</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#header {<br />
&nbsp; &nbsp; height: 150px;<br />
&nbsp; &nbsp; background-image: url(cloud.png);<br />
&nbsp; &nbsp; background-position: 0% 0%;<br />
}</div></div>
</pre>
<p>You&#8217;ll need to assign &#8216;background-image&#8217; and &#8216;background-position&#8217; separately.</p>
<p>Now build a @-webkit-keyframes animation like so. The &#8216;moveIt&#8217; is the name of the animation.</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@-webkit-keyframes moveIt {<br />
&nbsp; &nbsp; &nbsp;0% {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background-position: 0% 0%;<br />
&nbsp; &nbsp; &nbsp;}<br />
&nbsp; &nbsp; &nbsp;100% {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; background-position: 0% 150%;<br />
&nbsp; &nbsp; &nbsp;}<br />
}</div></div>
</pre>
<p>As of today Safari is the only browser that supports these types of animations so you&#8217;ll have to use it to view the demo.</p>
<p>Now assign the animation behaviours to the header CSS.</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#header {<br />
&nbsp; &nbsp; height: 150px;<br />
&nbsp; &nbsp; background-image: url(cloud.png);<br />
&nbsp; &nbsp; background-position: 0% 0%;<br />
&nbsp; &nbsp; -webkit-animation-name: moveIt;<br />
&nbsp; &nbsp; -webkit-animation-duration: 20s;<br />
&nbsp; &nbsp; -webkit-animation-iteration-count: infinite;<br />
&nbsp; &nbsp; -webkit-animation-timing-function: linear;<br />
}</div></div>
</pre>
<p>You can see I&#8217;ve called the animation name &#8216;moveIt&#8217;. Then we have &#8216;duration&#8217;, count and timing. In the actual animation setup the image is being moved 150% of the height of the header. This seems to line up the images as it jumps back to zero. Don&#8217;t ask me how I worked this out I just got lucky!!! <img src='http://www.tobypitman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="viewdemo" href="http://development.tobypitman.com/clouds/clouds.html">View the Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/css3-scrolling-header-image/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pure CSS Sliding Image Gallery</title>
		<link>http://www.tobypitman.com/pure-css-sliding-image-gallery/</link>
		<comments>http://www.tobypitman.com/pure-css-sliding-image-gallery/#comments</comments>
		<pubDate>Mon, 03 May 2010 17:36:52 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=332</guid>
		<description><![CDATA[So, another random CSS3 experiment! This time it's an image gallery that has a slide effect.]]></description>
			<content:encoded><![CDATA[<p>So, another random CSS3 experiment! This time it&#8217;s an image gallery that has a slide effect. </p>
<p>This was a bit tricky to work out but I got there in the end. The idea is to get one image to slide in while the current image slides out. There&#8217;s a lot of z-index going on as well so the new image always appears to be at the top.</p>
<p>I&#8217;m not totally sure how I got the z-index to work or why it does! One thing I&#8217;m sure of is you have to use CSS Animations, not Transitions! There are two main @keyframe set ups for this webkit animation. </p>
<p>One to animate the :target image in</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/* Animation for the :target image. Slides the image in. */<br />
<br />
@-webkit-keyframes moveTarget {<br />
&nbsp; &nbsp; 0% {<br />
&nbsp; &nbsp; &nbsp; &nbsp; left:-700px;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; 100% { <br />
&nbsp; &nbsp; &nbsp; &nbsp; left:0px;<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
<br />
ul#slider li:target {<br />
&nbsp; &nbsp; -webkit-animation-name: moveTarget; <br />
&nbsp; &nbsp; -webkit-animation-duration: .5s; <br />
&nbsp; &nbsp; -webkit-animation-iteration-count: 1;<br />
&nbsp; &nbsp; top:0px;<br />
&nbsp; &nbsp; left: 0px;<br />
&nbsp; &nbsp; z-index: 10;<br />
}</div></div>
</pre>
<p>And one to move the current :target image out</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/*<br />
Animation for the current image. Slides it out and back to the starting position. <br />
Adds a lower z-index than the now current image.<br />
*/<br />
<br />
@-webkit-keyframes moveIt {<br />
&nbsp; &nbsp; 0% {<br />
&nbsp; &nbsp; &nbsp; &nbsp; left:0px; &nbsp; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; 50% {<br />
&nbsp; &nbsp; &nbsp; &nbsp; left:700px; <br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; 100% { <br />
&nbsp; &nbsp; &nbsp; &nbsp; left:-700px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; z-index: 5;<br />
&nbsp; &nbsp; }<br />
}<br />
<br />
ul#slider li:not(:target) {<br />
&nbsp; &nbsp; -webkit-animation-name: moveIt; <br />
&nbsp; &nbsp; -webkit-animation-duration: 1.5s; <br />
&nbsp; &nbsp; -webkit-animation-iteration-count: 1;<br />
&nbsp; &nbsp; top:0px;<br />
&nbsp; &nbsp; left: 0px;<br />
}</div></div>
</pre>
<p>The first animation has one step over 0.5 secs. The second has three over 1.5secs. I&#8217;m sure you get the picture. The time it takes for the for the image to move in is the time it take for the other image to move out (50%)  before it get&#8217;s returned to the start position ready to come in again. The image moving out is given a lower z-index so it isn&#8217;t seen moving behind the current image to the start position.</p>
<p>Here&#8217;s a picture!</p>
<p><img src="http://www.tobypitman.com/wp-content/uploads/2010/05/move.png" alt="" title="move" width="589" height="202" class="aligncenter size-full wp-image-334" /></p>
<p>Plays nice in Firefox and Opera too just without the animation. I&#8217;ve not looked at it in IE as I&#8217;m on a Mac and just can&#8217;t be arsed to deal with it as this is just a bit of fun. It doesn&#8217;t support :target so it won&#8217;t work anyway. Maybe in IE9?</p>
<p>Yes it looks like Galleria, needed some quick images. Maybe this could prove to be a leaner alternative in the future for image galleries and featured content sliders. I&#8217;ve no doubt this could be intergated into Wordpress very easily or some kind of dynamic PHP gallery (from a folder of images) script.</p>
<p>Anyway, you can have a look at the demo and decide for yourself. <img src='http://www.tobypitman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="viewdemo" href="http://development.tobypitman.com/slideshow/index3.html">Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/pure-css-sliding-image-gallery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dynamic CSS3 Animated Accordian Menu</title>
		<link>http://www.tobypitman.com/dynamic-css3-animated-accordian-menu/</link>
		<comments>http://www.tobypitman.com/dynamic-css3-animated-accordian-menu/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 12:34:49 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=292</guid>
		<description><![CDATA[So I've been doing some more CSS3 experiments and I think I've cracked the Accordian thing. I actually tried this out ages ago and ran into the same problems other people had had, namely animating the height of an enclosing element couldn't be dynamic.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tobypitman.com/wp-content/uploads/2010/04/text.png"><img src="http://www.tobypitman.com/wp-content/uploads/2010/04/text.png" alt="" title="text" width="590" height="307" class="alignleft size-full wp-image-314" /></a></p>
<p>So I&#8217;ve been doing some more CSS3 experiments and I think I&#8217;ve cracked the Accordian thing. I actually tried this out ages ago <a href="http://development.tobypitman.com/css/accordion.html">2008 Demo</a> and ran into the same problems other people had later on, namely animating the height of an enclosing element couldn&#8217;t be dynamic it had to be fixed.</p>
<p>What do I mean? If your using CSS3 Transitions you have to have a start and end value, say.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">div <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; -webkit-transition<span style="color: #00AA00;">:</span> all .5s ease-in-out<span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
div<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>The issue was how do you know how high each of the accordian panels are that your animating? Each one might have a different number of elements. Now CSS doesn&#8217;t allow any sort of  loops or math like Javascript so you can&#8217;t find out the height based on the number of elements.</p>
<p>Then it hit me! Why bother with the container height and instead focus on the elements inside it! All the things you&#8217;d put inside a div are going to have static values right, like say an &#8216;a&#8217; tags height. Why not animate that instead thus causing the container to collapse.</p>
<p>Let&#8217;s start with an Accordian menu. Here&#8217;s the basic markup, a simple <em>ul</em> with <em>li&#8217;s</em>.</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;ul class=&quot;menu&quot;&gt;<br />
&lt;li class=&quot;title&quot;&gt;&lt;a id=&quot;1&quot; href=&quot;#1&quot;&gt;&lt;span&gt;Stuff&lt;/span&gt;&lt;/a&gt;<br />
&nbsp; &nbsp; &lt;ul&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;/ul&gt;<br />
&lt;/li&gt;<br />
<br />
&lt;li class=&quot;title&quot;&gt;&lt;a id=&quot;2&quot; href=&quot;#2&quot;&gt;&lt;span&gt;Stuff&lt;/span&gt;&lt;/a&gt;<br />
&nbsp; &nbsp; &lt;ul&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;#&quot;&gt;list&lt;/a&gt;&lt;/li&gt;<br />
&nbsp; &nbsp; &lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;</div></div>
</pre>
<p>You&#8217;ll notice that the &#8216;a&#8217; has an &#8216;id&#8217; and the &#8216;href&#8217; is targeting that id. This allows us to use the CSS3 <em>:target</em> selector for our animation, you&#8217;ll notice it&#8217;s actually targeting itself! I&#8217;ve done this for a reason.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.title</span> ul li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; -webkit-transition<span style="color: #00AA00;">:</span> all .5s ease-in-out<span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp;<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #3333ff;">:target </span><span style="color: #00AA00;">+</span> ul li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>In the above CSS you&#8217;ll see I&#8217;ve used the &#8216;+&#8217; adjacent sibling selector when using <em>:target</em>. This says effect the next <em>ul&#8217;s</em> list items &#8216;a&#8217; tags. When they shrink the enclosing &#8216;ul&#8217; is then effectively invisible as there is no &#8216;height&#8217; inside it.</p>
<p>Funnily enough it&#8217;s been two years since I tried the original CSS3 accordion with the height issues and this will still only render in Webkit browsers so you&#8217;ll need <strong style="color:red;">Safari or Chrome</strong> to view it properly, it will come up in Firefox but without all the CSS3 fluff! This is an example of a menu full of links.</p>
<p><a href="http://development.tobypitman.com/css/css3accordian.html" class="viewdemo">Menu Demo</a></p>
<p>The next example is a text box accordian. This time instead of worrying about the container height I&#8217;ve targeted the paragraph tag. I&#8217;ve now put the &#8216;id&#8217; in the list item and used the decendant selector &#8216;>&#8217; to target all &#8216;p&#8217; tags inside that list item.</p>
<pre>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;ul class=&quot;menu&quot;&gt;<br />
&lt;li class=&quot;title&quot; id=&quot;1&quot;&gt;&lt;a href=&quot;#1&quot;&gt;&lt;span&gt;Stuff&lt;/span&gt;&lt;/a&gt;<br />
&nbsp; &nbsp; &lt;p&gt;Lorem ipsum dolor sit amet........&lt;/p&gt;<br />
&lt;/li&gt;<br />
<br />
&lt;li class=&quot;title&quot; id=&quot;2&quot; &gt;&lt;a href=&quot;#2&quot;&gt;&lt;span&gt;More Stuff&lt;/span&gt;&lt;/a&gt;<br />
&nbsp; &nbsp; &lt;p&gt;Lorem ipsum dolor sit amet.........&lt;/p&gt;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &lt;p&gt;Lorem ipsum dolor sit amet..........&lt;/p&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;</div></div>
</pre>
<p>Here&#8217;s the CSS. The target parameters are padding, line-height and margin-bottom. The line-height and margin-bottom are doing all the work and the &#8216;p&#8217; tag is given <em>overflow:hidden;</em> to make it disappear.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.title</span> p <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; -webkit-transition<span style="color: #00AA00;">:</span> all .5s ease-in-out<span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0em</span> <span style="color: #933;">20px</span> <span style="color: #933;">0em</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0em</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-1.9em</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>&nbsp; &nbsp; <br />
&nbsp;<span style="color: #00AA00;">&#125;</span><br />
&nbsp;<br />
<br />
<span style="color: #3333ff;">:target </span><span style="color: #00AA00;">&gt;</span> p <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">.5em</span> <span style="color: #933;">20px</span> <span style="color: #933;">1em</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.2em</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0em</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#070707</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>Here&#8217;s the demo. Even works with an image. Check the scource! This is totally fucked in Firefox as yet so don&#8217;t bother. </p>
<p><a href="http://development.tobypitman.com/css/css3accordiantext.html" class="viewdemo">Menu Demo</a></p>
<p>Sorry for the scrappy code but this was only an experiment (proof of concept) which works for now only in Webkit, as yet to my knowledge this is the only accordian that can generate dynamic heights for panels. And yes, it looks shit in IE8!! </p>
<p>Any thoughts or improvements welcome! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/dynamic-css3-animated-accordian-menu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>jQuery style menu with CSS3</title>
		<link>http://www.tobypitman.com/jquery-style-menu-with-css3/</link>
		<comments>http://www.tobypitman.com/jquery-style-menu-with-css3/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 11:25:25 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=196</guid>
		<description><![CDATA[Here's a quick experiment I did with CSS3. Again I was just mucking about with CSS3 transitions which could one day replace all the fancy jQuery animation tricks people use. The outcome was a really simple animated sliding verticle menu.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.tobypitman.com/wp-content/uploads/2008/12/css3menu.jpg" alt="css3menu" title="css3menu" width="590" height="300" class="alignnone size-full wp-image-210" /></p>
<p>Here&#8217;s a quick experiment I did with CSS3. Again I was just mucking about with CSS3 transitions which could one day replace all the fancy jQuery animation tricks people use. The outcome was a really simple animated sliding verticle menu.</p>
<p>If you want to view the demo <span style='color:red;' >you&#8217;ll need the lastest Safari</span> version or even better go get the latest nightly build of <a href="http://nightly.webkit.org/">webkit</a>. This might even work in Chrome but I haven&#8217;t checked it. Oddly enough it didn&#8217;t seem to like it on OSX Tiger in Coda but in Leopard it was fine? This is all a long way off anyway but good fun to play with! </p>
<p><a class="viewdemo" href="http://development.tobypitman.com/css/menu.html">Menu Demo</a></p>
<p>First off in the demo you might notice the gradient which is CSS too. Really easy to do that with this&#8230;.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>Now we&#8217;ll style the un-order list with some padding and a background image to create a ridge like effect that our menu items will appear out of. The cool thing about this is by using <span style='color:#c7d0cf;' >-webkit-background-size&#8217;</span> the image is stretched if you add more items to it making the whole thing a bit more dynamic.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #cc00cc;">#nav</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">60px</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">60px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>shad2.png<span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-background-<span style="color: #000000; font-weight: bold;">size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50%</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>Everything else is pretty bog standard really. A simple un-ordered list and that&#8217;s about it. The styling for the list item anchor tags is where it all happens. The addition of the <span style='color:#c7d0cf;' >&#8216;-webkit-transition:&#8217;</span> is going to allow us to animate to the <span style='color:#c7d0cf;' >&#8216;:hover&#8217;</span> state.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #cc00cc;">#nav</span> li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; -webkit-transition<span style="color: #00AA00;">:</span> all 0.3s ease-out<span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>It says <span style='color:#c7d0cf;' >&#8216;all&#8217;</span> animatable properties should animate over 300ms using <span style='color:#c7d0cf;' >&#8216;ease-out&#8217;</span>, similar to jQuerys easing functions.</p>
<p>Next we&#8217;ll add the styling for the anchor tags with some fancy <span style='color:#c7d0cf;' >-webkit-border-radius</span> and <span style='color:#c7d0cf;' >-webkit-box-shadow</span> to give it some shape and depth and complete it with a backgroung image for each item to enhance our interface effect, making them look like their coming from underneath the ridge.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #cc00cc;">#nav</span> li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; -webkit-transition<span style="color: #00AA00;">:</span> all 0.3s ease-out<span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#cbcbcb</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#174867</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #933;">15px</span> <span style="color: #933;">7px</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-border-top-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">4px</span> <span style="color: #cc00cc;">#888</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>The properties we&#8217;re going to style are <span style='color:#c7d0cf;' >color</span>, <span style='color:#c7d0cf;' >background-color</span> and <span style='color:#c7d0cf;' >left-padding</span> so let&#8217;s add them to the <span style='color:#c7d0cf;' >hover:</span> state.</p>
<pre>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ul<span style="color: #6666ff;">.nav</span> li a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ebebeb</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#67a5cd</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">7px</span> <span style="color: #933;">15px</span> <span style="color: #933;">7px</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
</pre>
<p>That&#8217;s about it really. No javascript and exactly the same effect. Probably be easy to make this degrade nicely for &#8220;certain&#8221; browsers. Now all you have to do is wait!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/jquery-style-menu-with-css3/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Guest post on CSS-tricks</title>
		<link>http://www.tobypitman.com/guest-post-on-css-tricks/</link>
		<comments>http://www.tobypitman.com/guest-post-on-css-tricks/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 21:33:29 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=45</guid>
		<description><![CDATA[I really love webdesign and CSS is one of my favorite things about it ( apart fom the girls and fast cars! ). Very pleased to say I've just done a guest post for Chris Coyier's great site <a href="http://css-tricks.com">css-tricks.com</a>. It's a tutorial on using CSS3 and jQuery to build a web clock.]]></description>
			<content:encoded><![CDATA[<p>I really love webdesign and CSS is one of my favorite things about it ( apart fom the girls and fast cars! ). Very pleased to say I&#8217;ve just done a guest post for Chris Coyier&#8217;s great site <a href="http://css-tricks.com">css-tricks.com</a>. It&#8217;s a tutorial on using CSS3 and jQuery to build a web clock.</p>
<p><img class="alignnone size-full wp-image-46" title="css-tricks-post" src="http://www.tobypitman.com/wp-content/uploads/2008/11/css-tricks-post.jpg" alt="" width="518" height="356" /></p>
<p>I&#8217;ve been doing some other experiments recently with CSS3. Here&#8217;s a rather neat animation using <strong>transform:skew</strong>. Safari 3/4, Google Chome only!!!!</p>
<p><a href="http://development.tobypitman.com/css/cube.html">Cube animation</a></p>
<p>Probably not very exciting unless your into web stuff&#8230;which I am!</p>
<p>Doing a very bizarre gig tomorrow. See you then!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/guest-post-on-css-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Tricks features my jQuery experiment!!!!</title>
		<link>http://www.tobypitman.com/css-tricks-features-my-jquery-experiment/</link>
		<comments>http://www.tobypitman.com/css-tricks-features-my-jquery-experiment/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 16:12:13 +0000</pubDate>
		<dc:creator>Toby</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.tobypitman.com/?p=26</guid>
		<description><![CDATA[When Chris Coyier of CSS-Tricks wrote me an e-mail and asked if he could use the example I'd posted on the CSS-Tricks forum using jQuery background animations for a tutorial I almost shat myself!!! ]]></description>
			<content:encoded><![CDATA[<p>When Chris Coyier of <a href="http://css-tricks.com">CSS Tricks</a> wrote me an e-mail and asked if he could use the example I&#8217;d posted on the CSS Tricks forum using jQuery background animations for a tutorial I almost shat myself!!!</p>
<p>Chris&#8217; blog CSS Tricks is one of my favorite blogs. He writes really useful tutorials and I&#8217;ve learned a great deal of cool stuff from him. Being a bit of a beginner at the Web Design thing having only been doing HTML stuff for a little over a year I was quite pleased (and a bit gobsmacked!) that what was a bit of an experiment learning jQuery turned into a full on CSS Tricks tutorial bonanza!!!<span id="more-26"></span></p>
<p>I couldn&#8217;t get it to work as a nav as my jQuery skills aren&#8217;t as good as Chris&#8217; so again I&#8217;ll learn something from his tutorial. This is totally cool!!!!!</p>
<p>You can see the tutorial <a href="http://css-tricks.com/garage-door-style-menu-using-animated-background-images-with-jquery/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tobypitman.com/css-tricks-features-my-jquery-experiment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
