<?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>San Bei Ji &#187; CSS</title>
	<atom:link href="http://www.sanbeiji.com/archives/tag/css/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sanbeiji.com</link>
	<description>三杯雞好吃!</description>
	<lastBuildDate>Wed, 18 Jan 2012 17:57:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Coloring the HR element line in CSS</title>
		<link>http://www.sanbeiji.com/archives/1307</link>
		<comments>http://www.sanbeiji.com/archives/1307#comments</comments>
		<pubDate>Wed, 07 Dec 2011 00:37:31 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[border-color]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[hr]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=1307</guid>
		<description><![CDATA[I never, ever use this element, but HR has been bequeathed new life in HTML5 and I may start using it for providing more thematic break awesomeness to my already blindingly-awesome prose and poetry. Anyway, someone asked me this question: &#8230; <a href="http://www.sanbeiji.com/archives/1307">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F1307%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Coloring%20the%20HR%20element%20line%20in%20CSS%22%20%7D);"></div>
<p>I never, ever use this element, but <a href="http://dev.w3.org/html5/markup/hr.html">HR has been bequeathed new life in HTML5</a> and I may start using it for providing more thematic break awesomeness to my already blindingly-awesome prose and poetry.</p>
<p>Anyway, someone asked me this question: Is color supported in all browsers by the HR element? To which I replied: &#8220;I have no clue. Let me investigate.&#8221;</p>
<p>Here&#8217;s an initial test:</p>
<p><code><br />
&lt;!DOCTYPE html&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;meta charset=&quot;utf-8&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HR colors I have known...&lt;/title&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.blue {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color:blue;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.red {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;border-color:red;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/style&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;blue:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;hr class=&quot;blue&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;red:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;hr class=&quot;red&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;green:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;hr color=&quot;green&quot;&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
<p>Well hambone. Using the text rule for color on WebKit browsers yields no color change. Works fine in all cases in Firefox. IE gives no quarter to the border-color CSS property, but works fine with the text color value. Every browser supports HTML color attributes, but you know that using presentational markup is as wrong as Michelle Bachmann&#8217;s views on <a href="http://scienceblogs.com/pharyngula/2006/10/bachmann_on_id.php">evolution</a> and <a href="http://scienceblogs.com/pharyngula/2011/09/michele_bachmann_pseudo-scient.php">vaccination</a>, so you just say no.</p>
<p>So what&#8217;s a poor web dev to do? Define a border width:</p>
<p><code><br />
.red {<br />
&nbsp;&nbsp;&nbsp;&nbsp;border:none;<br />
&nbsp;&nbsp;&nbsp;&nbsp;border-bottom:thin solid red;<br />
}<br />
</code></p>
<p>Replacing the original border-color rule with the shorthand listed here, or just providing an explicit border-width property, will render a consistent 2 pixel line in all browsers. If we just wrote something like border:thin solid red; we&#8217;d get a 2-pixel border &#8211; see you&#8217;d think the HR element is just a line, but in fact the browsers all treat it like a box it seems. So we have to clear it out with border:none; and then add a border-bottom or border-top rule to set a 1 pixel line. If you want different widths, you have arguably more accurate control by only having to argue with one border instead of two.</p>
<p>What&#8230; you want to replace that HR with a background image? Good idea. <a href="http://blog.neatlysliced.com/2008/03/hr-image-replacement/">Check out this post at Neatly Sliced for the answer</a>, and gird your loins for the usual IE kludgeries.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/1307/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A quick book review: Responsive Web Design</title>
		<link>http://www.sanbeiji.com/archives/1304</link>
		<comments>http://www.sanbeiji.com/archives/1304#comments</comments>
		<pubDate>Mon, 14 Nov 2011 19:30:57 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[responsive]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=1304</guid>
		<description><![CDATA[Just finished reading an excellent book: &#8220;Responsive Web Design&#8221; by Ethan Marcotte. If you build web pages, I want you to read this book. Here&#8217;s a few of my thoughts on what I just learned, and why you should read &#8230; <a href="http://www.sanbeiji.com/archives/1304">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F1304%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22A%20quick%20book%20review%3A%20Responsive%20Web%20Design%22%20%7D);"></div>
<p>Just finished reading an excellent book: &#8220;<a href="http://www.abookapart.com/products/responsive-web-design" title="A Book Apart, Responsive Web Design">Responsive Web Design</a>&#8221; by <a href="http://unstoppablerobotninja.com/" title="The Unstoppable Robot Ninja">Ethan Marcotte</a>. If you build web pages, I want you to read this book. Here&#8217;s a few of my thoughts on what I just learned, and why you should read this one too.</p>
<p>The book begins with an overview of the evolution of page layout in web design, starting with it&#8217;s roots in printed page design and moving on to today&#8217;s reality that there is a multitude of screens and devices out there, with more on the way. We cannot predict what type of device our readers will show up with, and must adjust our belief system (if we have one) to accommodate the new realities that the various screen widths and mobile device sizes present us with.</p>
<p>The second chapter discusses the idea of designing within the constraints of a flexible typographic grid. Grid systems are somewhat of an artificial constraint that designers place on themselves to provide balance and symmetry to page layout, and on screen a new challenge is presented in that the page size is no longer fixed. The main takeaway here is to design content in flexible porportions to the variable screen widths that might be used to access your web pages. Mr. Marcotte puts forth some simple, accessible ideas for developers to leverage, making text more readable on unknown devices by putting forth a formula that I&#8217;ll repeat here mostly for the purposes of getting my own head wrapped around it:</p>
<p><code>target ÷ context = result</code></p>
<p>To decode Mr. Marcotte&#8217;s example, he begins with an assumption of a base font size of 16px. The headline in the comp is defined to be 24px. So to make it flexible, divide:</p>
<p><code>24 ÷ 16 = 1.5</code></p>
<p>And so the headline should be defined as 1.5em. Simple and elegant rule of thumb. Now we just need to remember to do it.</p>
<p>Chapter 3 applies this principle to flexible images, and expands upon it. There is the inevitable Questionable Functionality Challenge™ presented to us by Internet Explorer, which is quickly defused. That&#8217;s a lot of ink to dedicate to an obsolete web browser and the example demonstrates where the real problem lies by showing how awful text looks in resized images. But you aren&#8217;t locking up text in your images, right? I know, I know, it&#8217;s an academic example and clearly illustrates the failings of IE&#8217;s image resize capabilities. Let&#8217;s move on.</p>
<p>Chapter 4 introduces media queries. We&#8217;re finally at what I consider to be the coolest and most important part of the book &#8211; how to progressively enhance your web page layouts through the media query construct. Mr. Marcotte makes the argument in favor of using the min-width property instead of things like max-width (which tends to yield excessive code) and min-device-width (which only pertains to devices and doesn&#8217;t take into account variable web browser windows.) The max-width property is introduced for those that want to stop the insanity. (I do know people that expand their web browser to the full width of their 27&#8243; high resolution monitors.)</p>
<p>Chapter 5 pulls it all together with strategies to integrate responsive design into your team&#8217;s workflow; how to make your design process itself a responsive one. He builds the case for <a href="http://www.lukew.com/">Luke Wroblewski</a>&#8216;s &#8220;<a href="http://www.lukew.com/ff/entry.asp?933">Mobile First</a>&#8221; philosophy (a case that was already built up a bit in chapter 1) and finishes it all of with how to incorporate progressive enhancement using JavaScript to selectively pull in a slideshow component only when JavaScript is available and all the stars are in the proper alignment.</p>
<p>Overall, my belief has always been somewhat of the philosophy that there should be just &#8220;one web&#8221;; no &#8220;mobile web&#8221; or any other sort of alternate web reality that we should somehow slip into. Today&#8217;s mobile devices that are in fact being used to access the web are billed as fully capable web browsing devices, and indeed they are. Why deliver a shrunken-down version of your website just because they have a 3&#8243; wide screen these days? It no longer makes sense in most cases; just reposition your content to accommodate their view. Every chapter includes simple, usable techniques that work, and I feel that these gems of advice should be a core part your future projects.</p>
<p>Lastly, I am very thankful for the appearance of the <a href="http://www.abookapart.com/">A Book Apart</a> series. Each one of these volumes is, I believe, how a tech book should be: concise, full of valuable, practical, actionable information. I have read several of these so far, and each one has been a hit. I look forward to more.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/1304/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cheatsheet from today&#8217;s Open Web Camp &#8220;Refactoring for Mobile&#8221; talk</title>
		<link>http://www.sanbeiji.com/archives/1175</link>
		<comments>http://www.sanbeiji.com/archives/1175#comments</comments>
		<pubDate>Sun, 18 Jul 2010 05:56:09 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=1175</guid>
		<description><![CDATA[For the Open Web Camp attendees, here&#8217;s my cheatsheet from the Refactoring for Mobile talk I gave today at Stanford: Get it as a CSS file and view it in your favorite code editor: walkthrough.css Or preview here: /* The &#8230; <a href="http://www.sanbeiji.com/archives/1175">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F1175%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2Fa7Z6gx%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Cheatsheet%20from%20today%27s%20Open%20Web%20Camp%20%5C%22Refactoring%20for%20Mobile%5C%22%20talk%22%20%7D);"></div>
<p>For the Open Web Camp attendees, here&#8217;s my cheatsheet from the Refactoring for Mobile talk I gave today at Stanford:</p>
<p>Get it as a CSS file and view it in your <a href="http://macromates.com/">favorite</a> <a href="http://www.vim.org/">code</a> <a href="http://www.adobe.com/products/dreamweaver/">editor</a>: </p>
<p><a href='http://www.sanbeiji.com/wp-content/uploads/2010/07/walkthrough.css' style="font-weight:bold;">walkthrough.css</a></p>
<p>Or preview here:</p>
<p><code><br />
/*<br />
The first thing we need is a media query and to add<br />
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,<br />
	minimum-scale=1.0, maximum-scale=1.0&quot;&gt;<br />
to the head:<br />
*/<br />
@media only screen and (max-device-width:480px) {<br />
/*<br />
For starters, note the two divs #wrapper and #contents.<br />
Let's use those to create our structural layout and<br />
fold back in some of those design elements.<br />
*/<br />
	#wrapper {<br />
		background:url(img/back2.png) no-repeat center top;<br />
		margin-top:-1em;<br />
	}<br />
	#contents {<br />
		text-align:left;<br />
		width:95%;<br />
		margin:0 auto;<br />
	}<br />
/*<br />
Now, let's style the main navigation buttons. First, we<br />
will use inline-block to give block-like behavior to the<br />
buttons but retain width based on the content. Then we set<br />
the color, font size, and floating, and add a bit of box<br />
shadow.<br />
*/<br />
	.menu a {<br />
		display:inline-block;<br />
		background-color:#000;<br />
		float:left;<br />
		font-size:14px;<br />
		padding:1em 0.95em;<br />
		border-left:1px solid #888;<br />
		-webkit-box-shadow:0px 1px 5px #222;<br />
	}<br />
/*<br />
We can now use border-radius to style the left and right<br />
buttons instead of image files:<br />
*/<br />
	.first_menu a {<br />
		border-bottom-left-radius:6px;<br />
		border-left:none;<br />
		margin-left:2px;<br />
	}<br />
	.menu li:last-child a {<br />
		border-bottom-right-radius:6px;<br />
	}<br />
/*<br />
What if we flip to Landscape? There's a media query for<br />
that:<br />
*/<br />
	@media screen and (orientation:landscape) {<br />
		.first_menu a {<br />
			margin-left:78px;<br />
		}<br />
	}<br />
/*<br />
Now we can style the body content. #middle-contents is<br />
the main containing block. We can use the background image<br />
from the main stylesheet, but alternately we can use rgba<br />
backgrounds to get finer control. Add border radius and box<br />
shadow for depth.<br />
*/<br />
	#middle-contents {<br />
/*		background:url(img/side.png) repeat-y;*/<br />
		background-color:rgba(0,0,0,0.3);<br />
		padding:1em;<br />
		border-radius:10px;<br />
		-webkit-box-shadow:0px 1px 6px #000;<br />
		box-shadow:0px 1px 6px #000;<br />
		font-size:1.2em;<br />
		margin-bottom:1em;<br />
	}<br />
/*<br />
Let's style the banner text and have some fun with it using<br />
web fonts. Here's a font we'll pull in, using TTF and SVG formats.<br />
Sadly, the vendors have many opinions on the solution, but<br />
FontSquirrel can help sort it out.<br />
*/<br />
	@font-face {<br />
		font-family:'Lobster';<br />
		src: url('Lobster_1.3-webfont.ttf') format('truetype'),<br />
		url('Lobster_1.3-webfont.svg#webfontcOtP3oQb') format('svg');<br />
	}<br />
	#logo a {<br />
		display:block;<br />
		text-align:center;<br />
		padding-top:12px;<br />
		font-family:Lobster, sans-serif;<br />
		font-size:2.7em;<br />
		text-shadow:0px 2px 4px #000;<br />
	}<br />
	#logo h1 {<br />
		font-family:Lobster, sans-serif;<br />
		text-align:center;<br />
		font-size:1.5em;<br />
	}<br />
/*<br />
The float is creating a spacing issue. We can fix that<br />
with a clear:<br />
*/<br />
	#header { clear:both; }<br />
/*<br />
We are getting close. Now on to the bottom of the page.<br />
The #comments section is too wide. We need to reset it:<br />
*/<br />
	#comments {<br />
		width:100%;<br />
	}<br />
	#comments textarea, #comments input {<br />
		width:93%;<br />
		margin-bottom:0.5em;<br />
		padding:0.5em;<br />
		font-size:1.2em;<br />
		border:1px solid #000;<br />
		border-radius:6px;<br />
	}<br />
/*<br />
That input button could be nicer:<br />
*/<br />
	#comments input.button {<br />
		display:block;<br />
		width:80%;<br />
		margin:0 auto;<br />
		height:2.5em;<br />
		padding:0.5em;<br />
	}<br />
/*<br />
Now we have something that looks like it was meant for a<br />
mobile device. Let's wrap this up by making the final<br />
links look like tap-friendly buttons:<br />
*/<br />
	#right-col a {<br />
		display:block;<br />
		padding:0.5em;<br />
		font-size:1.3em;<br />
		font-weight:bold;<br />
		text-align:center;<br />
		background-image: -webkit-gradient(linear, left top, left bottom,<br />
			from(#666666), to(#666666), color-stop(.5,#333));<br />
		border:1px solid #000;<br />
		border-radius:20px;<br />
		margin-bottom:0.4em;<br />
	}<br />
/*<br />
Maybe those final link items were over the top.<br />
Let's restore them to inline links:<br />
*/<br />
	#copyrights a {<br />
		display:inline;<br />
		margin:0;<br />
		padding:0;<br />
		font-size:small;<br />
		border:none;<br />
		background-image:none;<br />
	}<br />
}<br />
/*<br />
Now add some HTML5: Add placeholder="I think..." to the textarea in<br />
comments.php, line 191.<br />
Add input types to email and url fields.<br />
Finish with atouch icon: &lt;link rel=&quot;apple-touch-icon&quot; href=&quot;piano.png&quot;/&gt;<br />
(Note to attendees: I forgot to add the piano.png file to my project files.<br />
But this works otherwise!)<br />
*/<br />
</code></p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/1175/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Doll up your tabular data</title>
		<link>http://www.sanbeiji.com/archives/1100</link>
		<comments>http://www.sanbeiji.com/archives/1100#comments</comments>
		<pubDate>Sun, 09 May 2010 06:25:06 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[tables]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=1100</guid>
		<description><![CDATA[In the science realm, we are often confronted with having to look at a dizzying number of flat tables representing experimental data. It wouldn&#8217;t hurt to spend a little time thinking about how that information is displayed in it&#8217;s native &#8230; <a href="http://www.sanbeiji.com/archives/1100">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F1100%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Doll%20up%20your%20tabular%20data%22%20%7D);"></div>
<p>In the science realm, we are often confronted with having to look at a dizzying number of flat tables representing experimental data. It wouldn&#8217;t hurt to spend a little time thinking about how that information is displayed in it&#8217;s native format. And often when we see tables that are &#8216;nice&#8217;, they are rendered as an image, thereby shielding wary and hapless internet searchers from all of the rich and informative data contained therein. I&#8217;m often asked to provide feedback on these things, so I was pleased to find a little tutorial with some nice examples of styling tables using CSS3 that I can throw out there. Here you go!</p>
<p><strong><a href='http://tympanus.net/codrops/2010/05/03/pimp-your-tables-with-css3/'>Pimp Your Tables with CSS3 | Codrops</a></strong></p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/1100/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In defense of the vendor prefix</title>
		<link>http://www.sanbeiji.com/archives/1090</link>
		<comments>http://www.sanbeiji.com/archives/1090#comments</comments>
		<pubDate>Mon, 22 Mar 2010 17:39:33 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=1090</guid>
		<description><![CDATA[PPK has written a thoughtful post titled CSS vendor prefixes considered harmful, and in it he outlines the case of why browser vendors should cease use of the vendor prefix condition. I sympathize with the case, but the very opening &#8230; <a href="http://www.sanbeiji.com/archives/1090">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F1090%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22In%20defense%20of%20the%20vendor%20prefix%22%20%7D);"></div>
<p>PPK has written a thoughtful post titled <a href="http://www.quirksmode.org/blog/archives/2010/03/css_vendor_pref.html">CSS vendor prefixes considered harmful</a>, and in it he outlines the case of why browser vendors should cease use of the vendor prefix condition.</p>
<p>I sympathize with the case, but the very opening example we have a problem: <code>border-radius</code>. When varying corner values are involved, vendor implementation consistency breaks down:<br />
<code><br />
-webkit-border-top-left-radius: 10px;<br />
-webkit-border-top-right-radius: 30px;<br />
-webkit-border-bottom-right-radius: 40px;<br />
-webkit-border-bottom-left-radius: 20px;<br />
-moz-border-radius-topleft: 10px;<br />
-moz-border-radius-topright: 30px;<br />
-moz-border-radius-bottomright: 40px;<br />
-moz-border-radius-bottomleft: 20px;<br />
border-top-left-radius: 10px;<br />
border-top-right-radius: 30px;<br />
border-bottom-right-radius: 40px;<br />
border-bottom-left-radius: 20px;<br />
</code></p>
<p>I&#8217;d say vendor prefixes are an unfortunate but necessary construct until things are a bit more solidified &#8211; at the very least between browser vendors, and ultimately as written in a W3C recommendation.</p>
<p>What I think is important though is that developers do include the expected latest draft code of CSS3 at the end of their declaration blocks. Shipping code, both from the vendor perspective as well as the web developer perspective speaks volumes. If IE is going to drop vendor prefixes and is going with the latest draft examples, then good on &#8216;em.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/1090/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RGBa and -webkit gradients: Yes.</title>
		<link>http://www.sanbeiji.com/archives/1002</link>
		<comments>http://www.sanbeiji.com/archives/1002#comments</comments>
		<pubDate>Wed, 27 May 2009 22:49:31 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[experiments]]></category>
		<category><![CDATA[gradients]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=1002</guid>
		<description><![CDATA[When @malarkey asked if RGBa worked with -webkit gradients, my own curiosity couldn&#8217;t resist a quick and fugly test to see. Yes indeed, it works: &#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD HTML 4.01//EN&#34; &#160;&#160;&#34;http://www.w3.org/TR/html4/strict.dtd&#34;&#62; &#60;html&#62; &#160;&#160;&#60;head&#62; &#160;&#160;&#160;&#160;&#60;title&#62;Gradient Test&#60;/title&#62; &#160;&#160;&#160;&#160;&#60;style type=&#34;text/css&#34; media=&#34;screen&#34;&#62; &#160;&#160;&#160;&#160;&#160;&#160;body &#8230; <a href="http://www.sanbeiji.com/archives/1002">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F1002%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22RGBa%20and%20-webkit%20gradients%3A%20Yes.%22%20%7D);"></div>
<p>When <a href="http://twitter.com/Malarkey/statuses/1940298306">@malarkey asked</a> if RGBa worked with -webkit gradients, my own curiosity couldn&#8217;t resist a quick and fugly test to see. Yes indeed, it works:</p>
<p><code><br />
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;<br />
&nbsp;&nbsp;&quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;<br />
&lt;html&gt;<br />
&nbsp;&nbsp;&lt;head&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;Gradient Test&lt;/title&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;body {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;background-color: green;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;div {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.8)), to(rgba(80,80,80,0.2)), color-stop(.5,#333333));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width:80%;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height:5em;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;margin:0 auto;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;padding:1em;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text-align:center;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color:white;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/style&gt;<br />
&nbsp;&nbsp;&lt;/head&gt;<br />
&nbsp;&nbsp;&lt;body&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt;Hello World!&lt;/div&gt;<br />
&nbsp;&nbsp;&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
<p><img src="http://www.sanbeiji.com/wp-content/uploads/2009/05/hellogradients.png" alt="Screen shot showing green bleed-through on a -webkit gradient div" title="Gradients with WebKit" class="alignnone size-full wp-image-1003" /></p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/1002/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The woes of CSS color in print typography</title>
		<link>http://www.sanbeiji.com/archives/953</link>
		<comments>http://www.sanbeiji.com/archives/953#comments</comments>
		<pubDate>Mon, 08 Dec 2008 04:57:21 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=953</guid>
		<description><![CDATA[As I was working through some documentation on styling CSS for print recently, I came across an oddity. Colors that I was specifying in my print styles were not getting represented properly at print time. Specify a nice shade of &#8230; <a href="http://www.sanbeiji.com/archives/953">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F953%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22The%20woes%20of%20CSS%20color%20in%20print%20typography%22%20%7D);"></div>
<p><a href="http://www.flickr.com/photos/sanbeiji/406392716/" title="Smoking Room/Prayer Room by sanbeiji, on Flickr"><img src="http://farm1.static.flickr.com/186/406392716_a2e4e12ccf_m.jpg" alt="Smoking Room/Prayer Room" class="right" /></a></p>
<p>As I was working through some documentation on styling CSS for print recently, I came across an oddity. Colors that I was specifying in my print styles were not getting represented properly at print time. Specify a nice shade of gray for some text? Maybe want to ghost print something very lightly on the printed page. No &#8211; not in Firefox. In fact, any shade of gray comes out as black in Gecko browsers. This behavior is only slightly more intelligent in Safari and IE7, but in all cases the user agent makes an assumption about what color of text constitutes being &#8220;too light&#8221; and then defaults to a darker shade of pale that is handled inconsistently across the various browsers. Printing font colors appears to be a messy situation.</p>
<p>Now the reason why the browser vendors have made this assumption is clear: Printing light text on what is almost always white paper is largely unreadable. Furthermore, printing in pure black, devoid of any complex color mixing, can make printing much faster, because the printer doesn&#8217;t have to mix in any red, green, or blue ink and can focus on getting the task done. But what is maddening to the designer trying to achieve accurate color representation in print from their web pages is that all of the major browsers assume that they are smarter than the designer, and recolor the text based on their own inconsistent algorithms. Actually, that may be assuming a bit much on the part of the browsers &#8211; sometimes the results defy logic. </p>
<p>To investigate further, I created a <a href="http://sanbeiji.com/tests/textcolor.php" title="Print CSS Text Color Test">testing page</a>. This page runs through some of the various color gamuts and creates a list entry for a number of color variations. The results are surprising&#8230; Here are some findings:</p>
<ul>
<li>
<p>Safari 3: Between rgb(0,0,0) and rgb(107,107,107), things appear fine. But then there is a breakdown between rgb(108,108,108) and rgb(127,127,127) where the text will randomly jump to a light gray &#8211; equivalent of rgb(199,199,199). For lack of a better term, I call this area &#8220;The Dead Zone,&#8221; and we will see it again soon. At rgb(128,128,128), the text color then jumps to black and as you ascend the values towards an expected white color, Safari yields a progressive amount of additional lightness to the text until it finally winds up at around rgb(171,171,171) where it should be 255 for all values.</p>
<p>The Dead Zone also occurs in the red, green, and blue colorspaces. If you fix red at 127, about halfway between the minimum value of 0 and the maximum value of 255, we get a dead zone between rgb(127,100,100) and rgb(127,127,127). Same ratios happen starting at rgb(100,127,100), and at rgb(100,100,127).</p>
<p>Finally, Safari renders rgb(0,255,255), rgb(255,0,255), and rgb(255,255,0) inconsistently from their adjacent color values.</p>
</li>
<li>
<p>Gecko browsers such as Firefox, Camino, and Flock print the entire gray space in black. (Exception: Firefox 3 will actually print the color exactly right &#8211; see below.) You cannot specify a light gray such as rgb(127,127,127) or anything else. It will always default to pure black whether you like it or not. If you fix a color bucket at 0, you will get semi-accurate color for the rest of the gamut, but the other color combinations will trend towards black text the lighter it gets.</p>
</li>
<li>
<p>In Opera 9, gray shades render accurately up until rgb(185,185,185), and then higher values default to black. In the points tested, the same conversion to black happens after values higher than rgb(127,211,211), rgb(255,156,156), rgb(87,255,255), rgb(209,209,0), rgb(193,193,127), and rgb(177,177,255).</p>
</li>
<li>
<p>IE7 never gets any lighter than rgb(108,104,102) for grayscale, and the rest of the color spaces don&#8217;t seem to allow anything lighter than a midrange hue equivalent to around 110 for any given value.</p>
</li>
<li>
<p>One last thing about Gecko browsers: The marker (the little bullet to the left of each list item) will display the correct color value in print, even though the text itself won&#8217;t match! Underlines/Overlines/strikethrough will match whatever color the text is though. So at least here you can see what the color was <em>supposed</em> to be&#8230;</p>
</li>
<li>
<p>The exception as mentioned above is Firefox 3. Firefox 3 has been tested to print the colors exactly as you see them on screen, and is the only browser thus far that works this way in a predictable manner.</p>
</li>
</ul>
<p>The conclusion I draw from all of this is that color in CSS print typography is woefully inconsistent, and I do recommend defaulting to black text in most cases simply because it is so problematic to predict what color you will actually wind up with in print. If you need color, go with a darker shade and <a href="http://sanbeiji.com/tests/textcolor.php" title="Print CSS Text Color Test">test your print output</a> in the four major modern browsers (IE, Safari, Firefox, Opera) to see what you can get away with.</p>
<p>Please feel free to <a href="http://sanbeiji.com/tests/textcolor.php" title="Print CSS Text Color Test">try the test suite for yourself</a> and let me know your findings in the comments or via a pingback. </p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/953/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Foundation Website Creation with CSS, XHTML, and JavaScript</title>
		<link>http://www.sanbeiji.com/archives/901</link>
		<comments>http://www.sanbeiji.com/archives/901#comments</comments>
		<pubDate>Sat, 09 Aug 2008 02:05:03 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[author]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.sanbeiji.com/?p=901</guid>
		<description><![CDATA[I would have announced this earlier, but somehow with the trip to Taiwan, the subsequent jet lag, and the whopper of a cold I had this past week has delayed me from getting this post out until now. But here &#8230; <a href="http://www.sanbeiji.com/archives/901">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_brick-red" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.sanbeiji.com%252Farchives%252F901%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Foundation%20Website%20Creation%20with%20CSS%2C%20XHTML%2C%20and%20JavaScript%22%20%7D);"></div>
<p><a href="http://www.flickr.com/photos/sanbeiji/2745721612/" title="In a real bookstore by sanbeiji, on Flickr"><img src="http://farm4.static.flickr.com/3247/2745721612_f7cf25d812_m.jpg" class="right" alt="In a real bookstore" /></a></p>
<p>I would have announced this earlier, but somehow with the trip to Taiwan, the subsequent jet lag, and the whopper of a cold I had this past week has delayed me from getting this post out until now. But here it is: My book titled &#8220;<a href="http://www.amazon.com/exec/obidos/ASIN/1430209917/ref=nosim/sanbeiji-20" title="Amazon.com: Foundation Website Creation with CSS, XHTML, and JavaScript">Foundation Website Creation with CSS, XHTML, and JavaScript</a>&#8221; is now out! I saw two copies of it today on the shelf at Barnes &amp; Noble in Walnut Creek earlier today (pictured).</p>
<p>This project came up at a real interesting time. I was just starting the final quarter of my masters degree program through University of Denver in computer information systems, and the last thing I wanted to do was to take on extra work. But of course, this opportunity to collaborate on this project was too good to pass up, so I opted for no sleep for a few months and somehow got both done last June. Man, it feels good to be done.</p>
<p>My fellow authors <a href="http://www.flyingtroll.com/" title="Jonathan Lane 1 ¾">Jonathan Lane</a> and <a href="http://maymay.net/" title="Meitar Moscovitz's Home on the Web: maymay dot net">Meitar Moscovitz</a> and I have put together a book that covers a professional introduction to the core technologies involved in front-end website development. In it we have tried to convey modern best practices from a web standards perspective as well as from a user-centric project management perspective to give the emerging web developer a solid foundation as to what to expect in a professional web design workflow. I hope the readers of this book find the information contained therein to be valuable platforms for further exploration and learning.</p>
<p>The book may <a href="http://www.amazon.com/exec/obidos/ASIN/1430209917/ref=nosim/sanbeiji-20">be ordered from Amazon</a>, and you might even find it on a local bookstore shelf!</p>

]]></content:encoded>
			<wfw:commentRss>http://www.sanbeiji.com/archives/901/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.sanbeiji.com @ 2012-02-11 04:14:19 -->
