<?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>techno.blog(&#34;Dion&#34;) &#187; css</title>
	<atom:link href="http://almaer.com/blog/tag/css/feed" rel="self" type="application/rss+xml" />
	<link>http://almaer.com/blog</link>
	<description>blogging about life, the universe, and everything tech</description>
	<lastBuildDate>Tue, 28 Aug 2012 14:41:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Having fun with Canvas, but the aim is to have to use it less and less; Performance wars move from raw JS to DOM</title>
		<link>http://almaer.com/blog/having-fun-with-canvas-but-the-aim-is-to-have-to-use-it-less-and-less-performance-wars-move-from-raw-js-to-dom</link>
		<comments>http://almaer.com/blog/having-fun-with-canvas-but-the-aim-is-to-have-to-use-it-less-and-less-performance-wars-move-from-raw-js-to-dom#comments</comments>
		<pubDate>Mon, 29 Jun 2009 17:27:51 +0000</pubDate>
		<dc:creator>dion</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://almaer.com/blog/?p=2459</guid>
		<description><![CDATA[
We are having a great time using Canvas for Bespin and a few other projects. Having text, images, and boxes as the primitives on the Web just isn&#8217;t good enough, so leap frogging to HTML5-land where we have the ability to arbitrarily paint pixels is fantastic. Mix this with the ability to directly manipulate video, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://almaer.com/blog/uploads/canvasbg.jpg" alt="canvasbg" title="canvasbg" width="500" height="313" class="alignnone size-full wp-image-2461" /></p>
<p>We are having a great time using Canvas for Bespin and a few other projects. Having text, images, and boxes as the primitives on the Web just isn&#8217;t good enough, so leap frogging to HTML5-land where we have the ability to arbitrarily paint pixels is fantastic. Mix this with the ability to directly manipulate video, and you have new opportunities.</p>
<p>However, Canvas also has obvious issues. How do you make it accessible? Or searchable? We have some ideas there, but they are a long way off. The goal has never been to use Canvas as the shiny toy. With Bespin, we actually tried to do it with DOM, and it wasn&#8217;t so much chutzpah as &#8220;can&#8217;t get it to perform&#8221;-pah that lead us down the path of Canvas. The usual suspects in the stack weren&#8217;t working for us, whereas others were blazing (e.g. JavaScript performance has blown us away, as has Canvas itself).</p>
<p>With major browsers like Firefox 3.5 (Safari 4, Chrome 2, etc) I am very much excited to work with browsers (say, the great Firefox team :) to kick into gear on the next level of improvements. The current batch have been competing on the performance of JavaScript. The new engines are fantastic, and really change the game on what can be done. Add in Web Workers to the magnitude speed bump of JS and Web devs can truly build responsive low-latency applications. We are now seeing improvements to the DOM, the next frontier. It is all well and good to have your JS run nice and speedy, but if the DOM can&#8217;t keep up then we are still in trouble. This is why we had to go to Canvas for Bespin in the first place!  I am hoping that we will be able to push on DOM and other APIs to get to a point where our DOM based Bespin can come back to town.</p>
<p>There is a time and a place for Canvas though. Rather than running the show, I much prefer the unobtrusive extensions that you can provide. I am also looking forward to seeing more tools that use a server side component to do some image manipulation&#8230; now work on the client through Canvas and ImageData. Vlad <a href="http://blog.vlad1.com/2009/06/22/to-sprite-or-not-to-sprite/">pondered</a> why CSS spriting tools are all server-side for example.</p>
<p>Christian Effenberger has been <a href="http://lab.netzgesta.de/">doing this kind of work</a> for a long time, and there is room for a lot more. I really like having Canvas available in more places, such as anywhere an image can be used (e.g. WebKit CSS extensions where you can use a Canvas as a background-image). That gives you full control to style something in zany ways, while still staying in DOM land. It also means that things can play together really nice. We continue to push more into CSS (transitions, gradients, etc.) and animation libraries (<a href="http://scripty2.com/">Scripty2</a> looks nice!</a>).</p>
<p><img src="http://ajaxian.com/wp-content/uploads/scripty2.png"></p>
<p>There is still much work to be done on putting the pieces together. I don&#8217;t know about you, but doing some common things with layout and UI still drive me nuts. Having the low level new tools like border-image are cool, but I really long for a tool that graphically lets me take a mock, cut it up, and build it out as a generalized component (stretches in the right place etc). The tool could then spit out more than just a border-image version, but old style divs + CSS to make it work everywhere. One tool, run output anywhere.</p>
<p><img src="http://almaer.com/blog/uploads/csstools.png" alt="csstools" title="csstools" width="500" height="335" class="alignnone size-full wp-image-2460" /></p>
<p>So, time to take a breath, take a look at what bleeding edge folk are doing to get rich experiences, and push it into the core platform itself. This will mean less Canvas, but used in the right places, and we will move down the stack again. If we don&#8217;t push use cases down into the core, then we are doomed to stagnate or fork the Web.</p>
]]></content:encoded>
			<wfw:commentRss>http://almaer.com/blog/having-fun-with-canvas-but-the-aim-is-to-have-to-use-it-less-and-less-performance-wars-move-from-raw-js-to-dom/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating custom scrollbars with CSS; How CSS isn&#8217;t great for every task</title>
		<link>http://almaer.com/blog/creating-custom-scrollbars-with-css-how-css-isnt-great-for-every-task</link>
		<comments>http://almaer.com/blog/creating-custom-scrollbars-with-css-how-css-isnt-great-for-every-task#comments</comments>
		<pubDate>Mon, 06 Apr 2009 16:01:37 +0000</pubDate>
		<dc:creator>dion</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Bespin]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Browsing]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[scrollbars]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://almaer.com/blog/?p=2359</guid>
		<description><![CDATA[Have you tried to create a nice rich experience and then been fighting the &#8220;defaults&#8221; to go the extra mile? This reared its head with me recently with Bespin. There are certain commands that pull up divs of content and we need to scroll through it. The problem is that the native scroll bar looks [...]]]></description>
			<content:encoded><![CDATA[<p>Have you tried to create a nice rich experience and then been fighting the &#8220;defaults&#8221; to go the extra mile? This reared its head with me recently with Bespin. There are certain commands that pull up divs of content and we need to scroll through it. The problem is that the native scroll bar looks so out of place:</p>
<p><img src="http://almaer.com/blog/uploads/uglyscrollbar.png" alt="uglyscrollbar" title="uglyscrollbar" width="588" height="529" class="alignnone size-full wp-image-2360" /></p>
<p>WebKit recently released the ability to <a href="http://webkit.org/blog/363/styling-scrollbars/">style scrollbars</a> in HTML elements (but not the main window, which you have been able to do in IE for donkeys years much to many peoples chagrin).</p>
<p>I decided to take it for a spin and loaded up the <a href="http://trac.webkit.org/export/41842/trunk/LayoutTests/scrollbars/overflow-scrollbar-combinations.html">examples</a> that show you being able to do every type of scrollbar that you can imagine:</p>
<p><img src="http://almaer.com/blog/uploads/manyscrollbars.png" alt="manyscrollbars" title="manyscrollbars" width="476" height="677" class="alignnone size-full wp-image-2361" /></p>
<p>So, it shouldn&#8217;t be so hard should it. From the blog post I see a few magically <code>::-webkit-scrollbar</code> CSS properties that I can plugin and be on my way. But looking at the example view source you see many pieces like this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">:</span>not<span style="color: #00AA00;">&#40;</span>.<span style="color: #993333;">none</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">:</span>not<span style="color: #00AA00;">&#40;</span>.double-start<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end</span><span style="color: #3333ff;">:single-button</span><span style="color: #00AA00;">,</span>
<span style="color: #00AA00;">:</span>not<span style="color: #00AA00;">&#40;</span>.<span style="color: #993333;">none</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">:</span>not<span style="color: #00AA00;">&#40;</span>.double-start<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end</span><span style="color: #3333ff;">:double-button</span><span style="color: #00AA00;">,</span>
<span style="color: #6666ff;">.single</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end</span><span style="color: #00AA00;">,</span>
<span style="color: #6666ff;">.double-end</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end</span><span style="color: #00AA00;">,</span>
<span style="color: #6666ff;">.double-both</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-6px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Holy pseudo classes batman! To be fair, this is partly due to the example page having many types of scrollbars in one (hence the not this and not that but the other) but there are still nested classes that you need to grok to get this going.</p>
<p>I quickly built a <a href="http://almaer.com/scrollbar/debug.html">debug scrollbar</a> where I styled the various pieces with simple colors and borders so I can see which was which. I also went about making the scrollbar have one up arrow on top, and one down arrow on the bottom.</p>
<p><img src="http://almaer.com/blog/uploads/debugscrollbar.png" alt="debugscrollbar" title="debugscrollbar" width="213" height="213" class="alignnone size-full wp-image-2362" /></p>
<p>The parts and pieces of a scrollbar are quite simple:</p>
<ul>
<li><b>Thumb</b>: This is the piece that shows you where you are in the scrollbar. This is the chap that you can move around</li>
<li><b>Track</b>: This is the area of the scrollbar that you can move the thumb up and down, or along (depending on the orientation). There is both the area between the top and the thumb, and between the bottom of the thumb and the bottom of the scrollbar</li>
<li><b>Buttons</b>: There may be buttons that you can click to increment or decrement the selection (which moves the thumb). There are various styles (single button, double button, etc)</li>
<li><b>Resizer</b>: This can change the are of the element (e.g. enlarge of shrink)</li>
<li><b>Corner</b>: This area may show up with both horizontal and vertical scrollbars open</li>
</ul>
<p>The debug scrollbar kinda shows these areas off in a simple visual way. Note how using <code>display: block|none</code> enabled me to setup the single button on top and bottom functionality:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Turn on a 13x13 scrollbar */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:vertical </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dashed</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Turn on single button up on top, and down on bottom */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:start</span><span style="color: #3333ff;">:decrement</span><span style="color: #00AA00;">,</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:end</span><span style="color: #3333ff;">:increment </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Turn off the down area up on top, and up area on bottom */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:start</span><span style="color: #3333ff;">:increment</span><span style="color: #00AA00;">,</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end</span><span style="color: #3333ff;">:decrement </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Place The scroll down button at the bottom */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:increment </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dashed</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Place The scroll up button at the up */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:decrement </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">purple</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dashed</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track</span><span style="color: #3333ff;">:vertical </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dashed</span> pink<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Top area above thumb and below up button */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:start </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Bottom area below thumb and down button */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">dashed</span> pink<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Track below and above */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* The thumb itself */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-thumb</span><span style="color: #3333ff;">:vertical </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Corner */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-corner</span><span style="color: #3333ff;">:vertical </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Resizer */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-resizer</span><span style="color: #3333ff;">:vertical </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>By moving the scrollbar around I could quickly see how this all worked, and it got me to this point which enabled me to plugin the images to <a href="http://almaer.com/scrollbar/index.html">make this puppy work for Bespin</a>:</p>
<p><img src="http://almaer.com/blog/uploads/bespinscrollbar.png" alt="bespinscrollbar" title="bespinscrollbar" width="212" height="213" class="alignnone size-full wp-image-2363" /></p>
<p>There were a couple of key tweaks needed to make this work:</p>
<p><b>Getting the buttons working</b></p>
<p>I used the same trick used in the debug example to turn on the up area above, and the down area below, and then it was just a matter of targeting the correct area for the arrow images:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Turn on single button up on top, and down on bottom */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:start</span><span style="color: #3333ff;">:decrement</span><span style="color: #00AA00;">,</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:end</span><span style="color: #3333ff;">:increment </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Turn off the down area up on top, and up area on bottom */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:start</span><span style="color: #3333ff;">:increment</span><span style="color: #00AA00;">,</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:end</span><span style="color: #3333ff;">:decrement </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Place The scroll down button at the bottom */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:end</span><span style="color: #3333ff;">:increment </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/scroll_cntrl_dwn.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Place The scroll up button at the up */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-button</span><span style="color: #3333ff;">:start</span><span style="color: #3333ff;">:decrement </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/scroll_cntrl_up.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><b>Get the track pieces to show</b></p>
<p>Next up was getting the gutter to show up. As mentioned early on, there is one track, but two areas that can show&#8230;. before the thumb and after. You can target these areas via <code>-webkit-scrollbar-track-piece:start || :end</code> and then it is a matter of using the multiple background ability available in new browsers. First we have the top of the gutter, and then a recurring background (and the same for the bottom). This way it just grows with the area that it gets:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Top area above thumb and below up button */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:start </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/scroll_gutter_top.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/scroll_gutter_mid.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">repeat-y</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* Bottom area below thumb and down button */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-track-piece</span><span style="color: #3333ff;">:vertical</span><span style="color: #3333ff;">:end </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/scroll_gutter_btm.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/scroll_gutter_mid.png</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">repeat-y</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><b>The Thumb</b></p>
<p>To get the thumb working, I thought I would do the same background image trick with three images (top of thumb, bottom of thumb, and background for the middle). Unfortunately this didn&#8217;t seem to work for me as I couldn&#8217;t get the middle to not go through the top and bottom. So, instead, I went with another new CSS trick: <code>border-image</code>. Here I splice the top and bottom of a thumb (the top and bottom 8 pixels) and stretch the rest:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* The thumb itself */</span>
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-webkit-scrollbar-thumb</span><span style="color: #3333ff;">:vertical </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">56px</span><span style="color: #00AA00;">;</span>
    -webkit-border-image<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/scroll_thumb.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">8</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">8</span> <span style="color: #cc66cc;">0</span> stretch stretch<span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">8</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">8</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>John Resig has a nice readable post on <a href="http://ejohn.org/blog/border-image-in-firefox/">border-image</a>.</p>
<p>And, there you have it. Now we can have nice Bespin-y scrollbars throughout Bespin. This may not be complete though, as we have the ability to also tie in <code>:active</code> and <code>:hover</code> work if we wish (change the color when selecting etc).</p>
<p>Of course, many people had &#8220;custom scrollbars&#8221;. There are plenty of comments on the original Surfin&#8217; Safari post, and various <a href="http://glyphobet.net/blog/essay/206">rants about Flash versions</a>. I agree that we have all seen bizarre Flash versions of scrollbars that don&#8217;t look like them at all, and where the designer didn&#8217;t bother to put in support for the mousescroll ability etc, but this is a bit different. It let&#8217;s you merge in your look and feel, yet with native scrollbar functionality.</p>
<p>And, with Google <a href="http://stopdesign.com/archive/2009/02/04/recreating-the-button.html">recreating the button</a> maybe we can feel a little bit better about tweaking the look of common UI elements as long as they are familiar enough to users to still make natural sense.</p>
<p>Now, the CSS declarative way to do scrollbars seems to get pretty ugly to me with all of he pseudo classes and various magic to get the functionality that you would like. I have to admit to liking <a href="http://www.mikechambers.com/blog/2009/04/03/kevin-lynchs-web-20-keynote-flash-catalyst-demo/">Kevin&#8217;s demo of Flash Catalyst at Web 2.0 Expo</a> and how it lets designers build out a scrollbar. We should be inspired to do tools like this. What if we had an API that wasn&#8217;t CSS, but let us say: &#8220;I want a Mac style double on the bottom button scrollbar. And, here is a thumb, here is a track, go for it&#8221;.</p>
<p>That being said, at least we do have the ability to do this kind of thing now. I hope that other browsers follow WebKit in this instance.</p>
]]></content:encoded>
			<wfw:commentRss>http://almaer.com/blog/creating-custom-scrollbars-with-css-how-css-isnt-great-for-every-task/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Interview Day: HTML / CSS</title>
		<link>http://almaer.com/blog/interview-day-html-css</link>
		<comments>http://almaer.com/blog/interview-day-html-css#comments</comments>
		<pubDate>Wed, 20 Feb 2008 15:27:57 +0000</pubDate>
		<dc:creator>dion</dc:creator>
				<category><![CDATA[Comic]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[interview]]></category>

		<guid isPermaLink="false">http://almaer.com/blog/interview-day-html-css</guid>
		<description><![CDATA[
What about the other languages?

COBOL
Haskell
JavaScript
Arc
Lisp
Ruby
Perl
Java
C++
C

Got some good ones for other languages like Fortran, BASIC or assembly?
]]></description>
			<content:encoded><![CDATA[<p><a href="http://almaer.com/blog/category/interview"><img src='http://almaer.com/blog/uploads/interviewdayhtml.png' alt='Interview Day: HTML / CSS' border='0'/></a></p>
<p>What about the <a href="http://almaer.com/blog/category/interview">other languages</a>?</p>
<ul>
<li><a href="http://almaer.com/blog/interview-day-cobol">COBOL</a></li>
<li><a href="http://almaer.com/blog/interview-day-haskell">Haskell</a></li>
<li><a href="http://almaer.com/blog/interview-day-javascript">JavaScript</a></li>
<li><a href="http://almaer.com/blog/interview-day-arc">Arc</a></li>
<li><a href="http://almaer.com/blog/interview-day-lisp">Lisp</a></li>
<li><a href="http://almaer.com/blog/interview-day-ruby">Ruby</a></li>
<li><a href="http://almaer.com/blog/interview-day-perl">Perl</a></li>
<li><a href="http://almaer.com/blog/interview-day-java">Java</a></li>
<li><a href="http://almaer.com/blog/interview-day-c-2">C++</a></li>
<li><a href="http://almaer.com/blog/interview-day-c">C</a></li>
</ul>
<p>Got some good ones for other languages like Fortran, BASIC or assembly?</p>
]]></content:encoded>
			<wfw:commentRss>http://almaer.com/blog/interview-day-html-css/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
