<?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>Everything In Between &#187; CSS</title>
	<atom:link href="http://maymay.net/blog/category/web-design/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://maymay.net/blog</link>
	<description>The brutally honest, first-person account of Meitar Moscovitz&#039;s life.</description>
	<lastBuildDate>Thu, 19 Jan 2012 08:54:24 +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>clickjane.css: A CSS User Style Sheet to Help Detect and Avoid Clickjacking Attacks</title>
		<link>http://maymay.net/blog/2008/12/29/clickjanecss-a-css-user-style-sheet-to-help-detect-and-avoid-clickjacking-attacks/</link>
		<comments>http://maymay.net/blog/2008/12/29/clickjanecss-a-css-user-style-sheet-to-help-detect-and-avoid-clickjacking-attacks/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 10:31:07 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Maymay Media]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security & Privacy]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=847</guid>
		<description><![CDATA[Clickjacking or, more formally, user interface redressing, is a class of security vulnerabilities similar to phishing scams. The technique uses web standards to trick unsuspecting victims into performing actions they were not intending to. Clickjacking does not rely on bugs in any software. Instead, the technique is simply an abuse of the growing graphical capabilities [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Clickjacking">Clickjacking</a> or, more formally, <dfn>user interface redressing</dfn>, is a class of security vulnerabilities similar to phishing scams. The technique uses web standards to trick unsuspecting victims into performing actions they were not intending to.</p>
<p>Clickjacking does not rely on bugs in any software. Instead, the technique is simply an abuse of the growing graphical capabilities that advanced web standards like <acronym title="Cascading Style Sheets">CSS</acronym> provide to web browsers. A good <a href="http://www.grc.com/sn/sn-168.htm">introduction to clickjacking</a> is provided by <a href="//grc.com/">Steve Gibson</a> and <a href="http://leoville.com/">Leo Laporte</a> on their <a href="//twit.tv/sn">Security Now! podcast</a>.</p>
<p>As far as I&#8217;m aware, only <a href="//mozilla.com/firefox/">Firefox</a> when combined with the <a href="//noscript.net/">NoScript</a> <a href="https://addons.mozilla.org/firefox/addon/722">add-on</a> and Internet Explorer when combined with the <a href="//guardedid.com/">GuardedID product</a> provide any measure of protection against clickjacking attacks. To date no other browser can detect, alert, or otherwise help you to avoid or mitigate the risks of clickjacking attacks.</p>
<p>That said, there&#8217;s gotta be <em>something</em> users of other browsers can do. Well, it may not be as much as what NoScript can do, but there is something: use a user style sheet to help expose common clickjacking attack attempts.</p>
<h2><code>clickjane.css</code> helps detect clickjacking attacks for all browsers</h2>
<p>Until browser manufacturers provide built-in protections against clickjacking attacks in their software (which is arguably the best place for such logic in the first place), I&#8217;ve started putting together <a href="http://github.com/meitar/clickjane-css/">a user style sheet I&#8217;m calling <code>clickjane.css</code></a> that attempts to instantly reveal common clickjacking attempts. Since it&#8217;s a <acronym title="Cascading Style Sheets">CSS</acronym> user style sheet, this approach should be cross-browser compatible so that users of any browser including Safari, Opera, and other browsers that don&#8217;t have other means of protecting against clickjacking attacks can use it.</p>
<p>I&#8217;ve only recently learned about this class of exploits and so I&#8217;m not supremely well-informed on the topic. As a result, the <code>clickjane.css</code> file is relatively sparse and currently only reveals what I&#8217;m sure is a small set of clickjacking attmpts. However, as I research the topic further and learn more about the actual underlying <acronym title="HyperText Markup Language">HTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> that clickjacking uses, I&#8217;ll be updating the <code>clickjane.css</code> code to reveal those attempts as well.</p>
<p>Naturally, contributions and assistance in any form are most welcome! Learn more about <code>clickjane.css</code> as well as how to use it at the <a href="http://github.com/meitar/clickjane-css/wikis">Clickjane <acronym title="Cascading Style Sheets">CSS</acronym> Github wiki</a>.</p>
<h2>Before and after <code>clickjane.css</code></h2>
<p>Here are two example screenshots of <a href="http://www.planb-security.net/notclickjacking/iframetrick.html">a benign clickjacking demo</a>.</p>
<ol>
<li>Before:
<div><div id="attachment_858" class="wp-caption alignnone" style="width: 310px"><a href="http://maymay.net/blog/wp-content/uploads/2008/12/before-clickjane.png"><img src="http://maymay.net/blog/wp-content/uploads/2008/12/before-clickjane-300x283.png" alt="Screenshot of Safari before clickjane.css is used to expose clickjacking attempts." title="before-clickjane" width="300" height="283" class="size-medium wp-image-858" /></a><p class="wp-caption-text">Screenshot of Safari before clickjane.css is used to expose clickjacking attempts.</p></div></div>
</li>
<li>After:
<div><div id="attachment_859" class="wp-caption alignnone" style="width: 310px"><a href="http://maymay.net/blog/wp-content/uploads/2008/12/after-clickjane.png"><img src="http://maymay.net/blog/wp-content/uploads/2008/12/after-clickjane-300x283.png" alt="Screenshot of Safari after clickjane.css is used to expose clickjacking attempts." title="after-clickjane" width="300" height="283" class="size-medium wp-image-859" /></a><p class="wp-caption-text">Screenshot of Safari after clickjane.css is used to expose clickjacking attempts.</p></div></div>
</li>
</ol>
<h2>Good habits you should get into to mitigate clickjacking risks</h2>
<p>Here is a list of behaviors that you should make habitual while you browse the web. Engaging in these behaviors can dramatically reduce the likelihood that you will be victimized by a clickjacking attack.</p>
<ul>
<li>Explicitly log out of any service you have logged in to when you are done. That log-out button is there for a reason: use it!</li>
<li>Avoid providing your browser with &#8220;Auto-Complete&#8221; information for critical sites, such as your bank.</li>
<li>Make sure you are <a href="http://www.adobe.com/support/security/advisories/apsa08-08.html">running Flash Player 10 or greater, which mitigates this vulnerability</a> for Adobe Flash content.</li>
</ul>
<h2>More resources to learn about clickjacking</h2>
<ul>
<li><a href="http://hackademix.net/2008/10/26/more-clickjacking/">Hackademix.net &#8211; More clickjacking</a> links to the <a href="http://video.google.com/videoplay?docid=-5747622209791380934">OWASP presentation</a>, the <a href="http://www.sectheory.com/clickjacking.htm">white paper</a>, and a blog post showing <a href="http://sirdarckcat.blogspot.com/2008/10/about-css-attacks.html">several <acronym title="Cascading Style Sheets">CSS</acronym>-based exploits</a>.</lI>
</ul>
<h2>Translations of this article:</h2>
<ul>
<li><ins datetime="2011-04-20T07:06:13+00:00"><a href="http://www.designcontest.com/show/everything-in-between-be">Belorussian (thanks, Bohdan Zograf)</a></ins></li>
<li><ins datetime="2011-08-24T20:14:39+00:00"><a href="http://webhostingrating.com/libs/clickjane-css-a-css-ua">Ukrainian (thanks, Alyona Lompar)</a></ins></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/12/29/clickjanecss-a-css-user-style-sheet-to-help-detect-and-avoid-clickjacking-attacks/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Why CSS needs delegation capabilities and not &#8220;variables&#8221;</title>
		<link>http://maymay.net/blog/2008/12/14/why-css-needs-delegation-capabilities-and-not-variables/</link>
		<comments>http://maymay.net/blog/2008/12/14/why-css-needs-delegation-capabilities-and-not-variables/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 07:55:04 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=815</guid>
		<description><![CDATA[It&#8217;s been too long since I joined the fun, if amazingly heated, debates over the direction that Web standards are moving in. Recently, given the &#8220;free&#8221; time to do so, I decided to dive head first into what is (sadly) an almost 14 year old debate. The result is this blog post, which is mostly [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been too long since I joined the fun, if amazingly heated, debates over the direction that Web standards are moving in. Recently, given the &#8220;free&#8221; time to do so, I decided to dive head first into what is (sadly) an almost 14 year old debate. The result is this blog post, which is mostly a response to Bert Bos&#8217;s essay <cite><a href="http://www.w3.org/People/Bos/CSS-variables">Why &#8220;variables&#8221; in <acronym title="Cascading Style Sheets">CSS</acronym> are harmful</a></cite> and Matt Wilcox&#8217;s opposing response to that essay, <cite><a href="http://mattwilcox.net/archive/entry/id/991/">Why <acronym title="Cascading Style Sheets">CSS</acronym> needs to borrow from programming languages</a></cite>. Their articles are each worthy of a read, possibly before this one.</p>
<p>Here&#8217;s <strong>the summary</strong> of my argument.</p>
<p class="summary">Adding many &#8220;programmatic&#8221; features to the <acronym title="Cascading Style Sheets">CSS</acronym> language such as variables, macros, or flow control <em>is</em> a mistake. However, <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s failure to simply encode visual <em>relationships</em> (instead of merely typographic properties)&mdash;a severe deficiency in the core language itself&mdash;requires the addition of delegation features. With the additional capability to reference an arbitrary element&#8217;s computed value regardless of its hierarchical context, <acronym title="Cascading Style Sheets">CSS</acronym> will be more accessible to both amateur and professional web designers, more capable, and will more forcefully promote the semantic Web and its ideals.</p>
<h3>In this corner: <acronym title="Cascading Style Sheets">CSS</acronym> variables are harmful</h3>
<p>Bert does a great job of summarizing the conclusion of his argument himself. In his essay, Bert says:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>Adding any form of macros or additional scopes and indirections, including symbolic constants, is not just redundant, but changes <acronym title="Cascading Style Sheets">CSS</acronym> in ways that make it unsuitable for its intended audience. Given that there is currently no alternative to <acronym title="Cascading Style Sheets">CSS</acronym>, these things must not be added.</p></blockquote>
<p>As we all know, one of the wonderful things about <acronym title="Cascading Style Sheets">CSS</acronym> is that the core language itself is remarkably simple. (What&#8217;s <em>not</em> simple is the spectacular way browser manufacturers have destroyed everyone&#8217;s hope that implementing <acronym title="Cascading Style Sheets">CSS</acronym>-based designs in the real world will ever be easy, but that&#8217;s a whole different can of worms.) Fundamentally, <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s syntax can be explained with a mere three major components: property/value pairs, declaration blocks, and rule sets.</p>
<p>What this means is that <acronym title="Cascading Style Sheets">CSS</acronym> <em>as a language</em> is stupidly easy to learn. I think everyone would agree that it&#8217;s certainly easier to learn than, say, JavaScript or <a href="//en.wikipedia.org/wiki/Extensible_Stylesheet_Language"><acronym title="eXtensible Stylesheet Language">XSL</acronym></a>. Now, that&#8217;s important because, without putting too fine a point on it, Bert mentions multiple times that <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s &#8220;intended audience&#8221; are the diverse and likely relatively technically ignorant content authors that are responsible for the overwhelming majority of web pages on the public Internet today.</p>
<p>He makes the very good point that <q cite="http://www.w3.org/People/Bos/CSS-variables">The value of the semantic Web isn&#8217;t defined by how well structured the best documents are, but by how well structured the vast majority of documents</q> are. In other words, <acronym title="Cascading Style Sheets">CSS</acronym> needs to remain instantly useable <em>and reusable</em> to these untrained, amateur web content publishers for the benefits of self-describing documents (i.e., the semantic Web) to see mass adoption.</p>
<p>To wit:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>reusing other people&#8217;s style sheets is more difficult if those style sheets contain user-defined names. Class names are an example. Their names may suggest why the author created them (assuming they are in a language you understand), but typically you will have to look at the document to see where they occur and why. Symbolic constants make that problem worse.</p></blockquote>
<p>And, later:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>For many people, style sheets with constants will thus simply not be usable. It is too difficult to look in two places at once, the place where a value is used and the place where it is defined, if you don&#8217;t know why the rule is split in this way. Many people are confused by indirection anyway and adding an extra one, in addition to the element and class names, has the same effect as obfuscating the style sheet.</p></blockquote>
<p>Whether or not you believe Bert Bos is underestimating the average web designer, it&#8217;s pretty clear that these are really good points. Nobody wants <acronym title="Cascading Style Sheets">CSS</acronym> to be obfuscated, hard to learn, or hard to reuse. That&#8217;d just be crazy talk.</p>
<h3>In the other corner: <acronym title="Cascading Style Sheets">CSS</acronym> variables are a real-world requirement</h3>
<p>The more features you add to an application, a programming language, or indeed any software, the more difficult it becomes to grok it. As the Python people would say, the larger a language gets the more difficult it is to hold all of it in your head. Nevertheless, adding &#8220;features&#8221; is sometimes the only way to add <em>capabilities</em>, and I don&#8217;t think anyone in their right mind would argue that, once written, software should never change. (That&#8217;d just be crazy talk, too.)</p>
<p>In his opposing arguments, Matt Wilcox recognizes this when he says, <q cite="http://mattwilcox.net/archive/entry/id/991/">Yes, the syntax should be simple, but the capabilities of <acronym title="Cascading Style Sheets">CSS</acronym> should not.</q> What he&#8217;s alluding to without verbalizing it is the balance between adding necessary capabilities without unnecessarily growing the &#8220;size of the language.&#8221;</p>
<p>However, Matt says that modern web design <em>methodologies</em> (e.g., separation of concerns between structure, presentation, and behavior) dictate that <acronym title="Cascading Style Sheets">CSS</acronym> needs more capabilities than it currently has:</p>
<blockquote cite="http://mattwilcox.net/archive/entry/id/991/"><p><acronym title="Cascading Style Sheets">CSS</acronym> lacks capabilities to allow truly flexible design, requiring layer upon layer of ‘tricks’ to accomplish certain objectives, requiring content to be structured ‘just so’ to achieve a display objective, or in the case of some designs proving instead to be completely incapable.</p>
<p>[…]</p>
<p><acronym title="Cascading Style Sheets">CSS</acronym>’s positioning is a cludge. It’s a cludge because you can only position relative to the last positioned parent container. Well, that limitation in itself dictates that all positioning relies upon how the content is structured. And that means the presentation and the content are not truly separable.</p></blockquote>
<p>To align <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s capabilities with the requirements of real-world web design objectives, he says, <acronym title="Cascading Style Sheets">CSS</acronym> needs to be capable of describing relationships between semantically and structurally arbitrary but visually related elements.</p>
<blockquote cite="http://mattwilcox.net/archive/entry/id/991/"><p>Visual design is fundamentally about relationships between elements. For all of the artistic flourishes and creativity, it’s about relationships. ‘That yellow’ only grabs your attention because of its contrasting relationship with ‘that blue’. ‘This heading’ only works as a heading because of it’s exaggerated relationship to the size of the body text. […] <acronym title="Cascading Style Sheets">CSS</acronym> has no clue about relationships, period. And that’s why <acronym title="Cascading Style Sheets">CSS</acronym> as it stands right now, is not good enough. That’s why <acronym title="Cascading Style Sheets">CSS</acronym> without variables (true variables), without basic logic, without maths, can never be as flexible as we need it to be.</p></blockquote>
<p>This is what web designers have been complaining about for (what feels like hundreds of) years. The fact that <acronym title="Cascading Style Sheets">CSS</acronym> has no capability to describe <em>presentational relationships</em> between elements in addition to directly describing an individual element&#8217;s presentational properties is a gaping hole that sorely degrades its ability to be a media-agnostic styling language. Every single web designer I&#8217;ve worked with has gasped at this omission, and though at first I didn&#8217;t understand why, the more I understood the principles behind graphic design the more I came to realize how fundamentally problematic this omission really is.</p>
<h3>Adding delegation makes <acronym title="Cascading Style Sheets">CSS</acronym> <em>easier</em> for designers</h3>
<p>As Matt eloquently stated, design is all about relationships. Good web designers create designs by constructing visual elements that have strong, often exacting relationships with other visual elements. There are many names and examples for this: visual language, visual hierarchy, the golden ratio, the grid, visual balance, the typographer&#8217;s scale, and so on.</p>
<p>What happens when the designer tries to define <em>a relationship</em> between elements? &#8220;How do I say that the whitespace between element A and element B should always be the same? How do I define element A&#8217;s height as half of element B&#8217;s?&#8221; These definitions, which are natural and necessary to the way designers work in both their mind and their mediums, are impossible to encode in <acronym title="Cascading Style Sheets">CSS</acronym>.</p>
<p>The closest you can get is declaring the same values to each element&#8217;s properties, not describing the relationship itself. This suffices only so long as these values are known ahead of time and are the same as one another, which severely limits the design possibilities we are capable of (without resorting to what Matt calls &#8220;tricks&#8221;). <em>That&#8217;s</em> why achieving simple visual effects are actually very complex and so, sadly, <em>that&#8217;s</em> where you&#8217;ll find the majority of indirection and obfuscation in <acronym title="Cascading Style Sheets">CSS</acronym> today. (I&#8217;m looking at you, <a href="http://www.alistapart.com/articles/fauxcolumns/">faux columns</a>.)</p>
<h3>So who wins?</h3>
<p>Both Bert Bos and Matt Wilcox have made some great points. Bert rightfully wishes to keep <acronym title="Cascading Style Sheets">CSS</acronym> lean and simple, even at the expense of some arguably beneficial styling power. Matt, on the other hand, argues that our needs as web designers have evolved faster than the technology to the point where <acronym title="Cascading Style Sheets">CSS</acronym> is <em>too</em> limited, fundamentally so.</p>
<p>The truth is, they&#8217;re both right. And they&#8217;re both wrong. Or rather, they are each taking a position that is too extreme. Bert&#8217;s absolutely correct when says that many of these proposed extensions are redundant and harmful, and yet Matt&#8217;s also correct that <acronym title="Cascading Style Sheets">CSS</acronym> lacks some fundamental capabilities that designers <em>expect</em> to be present.</p>
<p>Bert says that the <acronym title="Cascading Style Sheets">CSS</acronym> capabilities everyone&#8217;s asking for can be implemented using techniques that don&#8217;t rely on <acronym title="Cascading Style Sheets">CSS</acronym> whatsoever. These techniques, he says, make things like true <acronym title="Cascading Style Sheets">CSS</acronym> variables &#8220;redundant.&#8221;</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>There are examples of <acronym title="Cascading Style Sheets">CSS</acronym> with constants to satisfy all styles of programming, e.g.: <a href="http://davidwalsh.name/css-variables-php-dynamic">David Walsh</a> (in <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>), <a href="http://sperling.com/examples/pcss/">Tedd Sperling</a> (in <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>), <a href="http://www.digital-web.com/articles/generating_dynamic_css_with_php/">Digital Web Magazine</a> (in <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>), <a href="http://ecoconsulting.co.uk/training/css_includes.shtml">Eco Consulting</a> (in <acronym title="Server Side Include">SSI</acronym>), and <a href="http://icant.co.uk/articles/cssconstants/">Christian Heilmann</a> (<acronym title="Server Side Include">SSI</acronym> and <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>).</p></blockquote>
<p>Quite simply, he&#8217;s correct in stating that programmatic features need not be added to <acronym title="Cascading Style Sheets">CSS</acronym> proper to achieve desired results, but he&#8217;s incorrect in his apparent thinking that designers will be able to use these other tools to leverage <acronym title="Cascading Style Sheets">CSS</acronym>. Take, for instance, the probably more familiar (though not linked above) notion of using JavaScript to manipulate <acronym title="Cascading Style Sheets">CSS</acronym> values.</p>
<pre><code class="javascript">var x = document.getElementById('SideBar'); // get #SideBar element
var y = document.getElementById('MainColumn'); // get #MainColumn
var z = document.defaultView.getComputedStyle(y, '').getPropertyValue('height'); // get computed height of #MainColumn
x.style.height = ( parseInt(z) / 2 ) + 'px'; // set #SideBar's height 1/2 of #MainColumn's</code></pre>
<p>This is an example of programmatic code that uses variables and expressions. It sets the element with the ID of <code>SideBar</code> to half the pixel height of the element with the ID of <code>MainColumn</code>. It does this by obtaining the <code>MainColumn</code>&#8216;s height (at the time this code runs) and saving it in a variable, then performs some trivial math to half the value and use the result as the pixel height of the <code>SideBar</code>.</p>
<p>Doing this is currently impossible with <acronym title="Cascading Style Sheets">CSS</acronym> alone, yet it&#8217;s something that clearly belongs with whatever other &#8220;presentational&#8221; code exists and not in &#8220;programmatic&#8221; scripts that would otherwise be charged with defining &#8220;functionality.&#8221; As Matt states, using JavaScript to &#8220;script&#8221; solutions to <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s shortcomings like this is not an acceptable answer.</p>
<blockquote cite="http://mattwilcox.net/archive/entry/id/991/"><p><acronym title="Cascading Style Sheets">CSS</acronym> doesn’t have [basic logic or maths]. Nor is it the job of JavaScript to make up for this lack of abilities. JavaScript is about interaction behaviour, and what we are talking about here is pure display logic. Not interaction logic.</p></blockquote>
<p>Moreover, the <em>place</em> designers expect to put code like this is, of course, into a <acronym title="Cascading Style Sheets">CSS</acronym> style sheet. The <em>way</em> designers expect to put code like this into <acronym title="Cascading Style Sheets">CSS</acronym> is by adding delegation features. Requiring designers to learn JavaScript (or any other programming language) to encode such design relationships is nothing short of ridiculous. In what world is that easier for untrained laymen to understand than <acronym title="Cascading Style Sheets">CSS</acronym>?</p>
<h3>Adding delegation to <acronym title="Cascading Style Sheets">CSS</acronym> is worth the effort</h3>
<p>One of Bert&#8217;s arguments against such additions to <acronym title="Cascading Style Sheets">CSS</acronym> is that implementations would become harder to create, and that we&#8217;ll (almost certainly) see more bugs.</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>extending <acronym title="Cascading Style Sheets">CSS</acronym> makes implementing more difficult and programs bigger, which leads to fewer implementations and more bugs. That has to be balanced against the usefulness of the extension.</p></blockquote>
<p>Although I do agree with his statement that an extension&#8217;s usefulness has to be balanced against its potential costs, I think something so fundamental to design methodology as delegation greatly overcompensates for the cost of such implementation efforts. Moreover, if I understand Bert correctly and as he also discusses, the majority of implementations that would need to implement such delegation already have relatively complex internal structures to make the implementation effort somewhat easier:</p>
<blockquote cite="http://www.w3.org/People/Bos/CSS-variables"><p>There is no scoping [in proposals that only define <em>global</em> constants]. That means that an implementation needs a symbol table, but no stack. A stack would require a little bit more memory, but mostly it would make implementations more complex. (Although every programmer has, one hopes, learnt to program a symbol table with lexical scope during his training.) Constants in <acronym title="Cascading Style Sheets">CSS</acronym> are thus easier than, e.g., <a href="http://www.w3.org/TR/xml-names/"><acronym title="eXtensible Markup Language">XML</acronym> Namespaces,</a> which <em>are</em> lexically scoped.</p>
<p>It is different for those <acronym title="Cascading Style Sheets">CSS</acronym> implementations that provide a <a href="http://www.w3.org/TR/DOM-Level-2-Style/"><acronym title="Cascading Style Sheets">CSS</acronym> Object Model</a> (an <acronym title="Application Programming Interface">API</acronym> for manipulating a style sheet in memory). Those implementations <em>do</em> need to keep track of scope in some way, because adding or removing a line of the style sheet can make a previously redundant definition become meaningful.</p></blockquote>
<p>In order to use JavaScript to solve many of the shortcomings of <acronym title="Cascading Style Sheets">CSS</acronym>, as <em>huge</em> numbers of professional web developers do routinely, we use the very <acronym title="Cascading Style Sheets">CSS</acronym> Object Model whose prior implementation already exists for us to build upon.</p>
<h3><acronym title="Cascading Style Sheets">CSS</acronym> delegation doesn&#8217;t grow the size of the language</h3>
<p>For the sake of argument, let&#8217;s simplify our requirement somewhat so that our somewhat contrived example of design intent is to <em>create a relationship</em> between the <code>MainColumn</code> and the <code>SideBar</code> elements such that they are of equal height. This is more informally known as &#8220;making columns.&#8221;</p>
<p>Here&#8217;s what a natural, hypothetical snippet of <acronym title="Cascading Style Sheets">CSS</acronym> would look like if the language supported delegation features such that it could encode visual relationships.</p>
<pre><code class="css">#SideBar { height: #MainColumn; }</code></pre>
<p>This code theoretically says almost the exact same thing as the JavaScript shown earlier (save for the division, of course); it takes the computed value of the <code>MainColumn</code> element&#8217;s height property and applies that value to the <code>SideBar</code> element&#8217;s height property. In other words, &#8220;The SideBar&#8217;s (element B&#8217;s) height is always the same as the MainColumn&#8217;s (element A&#8217;s).&#8221; (Of course, this is a parse error in reality today.)</p>
<p>This extremely trivial example has some remarkably far-reaching implications, and yet there is really nothing radical about its syntax. Making this a reality significantly expands the capabilities of <acronym title="Cascading Style Sheets">CSS</acronym> without dramatically increasing the size of the language. This capability would not only <a href="http://mattwilcox.net/archive/entry/id/1030/" title="Why you should not use display:table; for layout.">beat the pants off</a> &#8220;<a href="http://www.sitepoint.com/blogs/2008/10/22/everything-you-know-about-css-is-wrong/" title="SitePoint's featuring articles and books about browser support for this."><acronym title="Cascading Style Sheets">CSS</acronym> tables</a>,&#8221; it also potentially obsoletes the arguably <a href="http://ejohn.org/blog/css3-template-layout/" title="Just because John Resig likes it doesn't mean it's good.">misguided efforts of the <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym> Advanced Layout</a> and Grid Positioning modules, too.</p>
<p>We&#8217;ve long since abandoned <code>table</code> layouts because they force us to use presentational markup. That&#8217;s still what &#8220;<acronym title="Cascading Style Sheets">CSS</acronym> tables&#8221; force us to do, too. In other words, with <code>display: table</code>, the <code>SideBar</code> needs to be a child of the <code>MainColumn</code> element or, maybe worse and more likely, a child of a semantically meaningless wrapper element.</p>
<p><acronym title="Cascading Style Sheets">CSS</acronym> positioning was introduced with the promise of freeing us from source-order-dependent styling, without which there is no hope of efficiently abstracting presentation away from structure. Moreover, <strong>abstracting presentation away from structure is the single most important prerequisite needed to improve document reusability and strengthen the semantic Web</strong>. Absolute positioning works, but limitations elsewhere in <acronym title="Cascading Style Sheets">CSS</acronym> mean its use is problematic for many designs, so in practice it doesn&#8217;t gain widespread adoption.</p>
<p>Here&#8217;s a theoretical solution to a two-column and a footer layout using <acronym title="Cascading Style Sheets">CSS</acronym> delegation with this semantic HTML:</p>
<pre><code class="html">&lt;body&gt;
    &lt;div id="MainColumn"&gt;I'm the main column.&lt;/div&gt;
    &lt;div id="SideBar"&gt;I'm the right-hand sidebar.&lt;/div&gt;
    &lt;div id="Legalese"&gt;No one will read me.&lt;/div&gt;
&lt;/body&gt;
</code></pre>
<p>The <acronym title="Cascading Style Sheets">CSS</acronym> would look extremely familiar, possibly like this:</p>
<pre><code class="css">#MainColumn { margin: 0 25% 1em 0; float: left; }
#SideBar { width: 25%; min-height: #MainColumn; }</code></pre>
<p>Using the same <acronym title="HyperText Markup Language">HTML</acronym>, the same solution using the <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym> Advanced Layout module would look something more like this, although to be frank I&#8217;m not certain I fully understand this syntax even after staring at it for months:</p>
<pre><code class="css">body {
    display: "a  b"
             ".  ." /1em
             "c  c"
             75% 25%
}
#MainColumn { position: a; }
#SideBar { position: b; }
#Legalese { position: c; }
</code></pre>
<p>Not only does there seem to me to be far more indirection in this method than there would be using <acronym title="Cascading Style Sheets">CSS</acronym> delegation, there is also an enormous increase to the size of the <acronym title="Cascading Style Sheets">CSS</acronym> language: a new (ASCII-art?!) value to the display property whose syntax is clunky at best. A similar story can be <a href="http://ajaxian.com/archives/w3c-css-grid-positioning" title="Ajaxian reports on a rumor that Internet Explorer 8 will add support for Grid Positioning and shows what that might look like in code.">said of the <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym> Grid Positioning module</a>, which does lots more than just add a new (already complex) <code>gr</code> <acronym title="Cascading Style Sheets">CSS</acronym> unit.</p>
<p>The upshot is that the Advanced Layout and the Grid Positioning modules are doing <em>some</em> of the right things in <em>many</em> of the wrong ways. Both those modules add unnecessary complexity to <acronym title="Cascading Style Sheets">CSS</acronym> without giving designers a natural way to say what they mean. They do more to introduce obfuscation and indirection than simple delegation would, and they aren&#8217;t as broadly capable. Both of them try to solve a specific problem instead of dealing with fundamental deficiencies in the <em>toolset</em> designer&#8217;s have to work with.</p>
<h3>Designers want relationships via delegation, not variables</h3>
<p>Adding delegation such as that I&#8217;ve just shown is a natural, necessary addition to <acronym title="Cascading Style Sheets">CSS</acronym> because it is how designers create visual components&mdash;such as grids&mdash;in their designs. Variables (and constants, and macros, etc.), which simply reuse and modify pre-defined statements aren&#8217;t what designers care about. Adding them <em>will</em> bloat <acronym title="Cascading Style Sheets">CSS</acronym> without adding useful functionality.</p>
<p>&#8220;Okay,&#8221; you may be saying to yourself, &#8220;but delegation is itself a kind of variable, isn&#8217;t it?&#8221; Technically yes, however adding delegation resolves the core deficiency in the <acronym title="Cascading Style Sheets">CSS</acronym> language that designers need to use every day. Yes, it&#8217;s technically a form of variable, but that&#8217;s not how designers think of it. To say that one element&#8217;s visual properties is like another makes a variable only by creating a logical and visually appropriate mapping from the first element&#8217;s property to the second independent of markup, thereby avoiding indirection in the form of a variable name or other unfamiliar symbol.</p>
<p>Delegation like this doesn&#8217;t require the addition of anything other than what already exists in <acronym title="Cascading Style Sheets">CSS</acronym>. Class names and ID values are identifiers whose indirection people <em>already</em> have to deal with. Using them for delegation (to reference another element&#8217;s <em>style</em>) doesn&#8217;t increase the cognitive load any more than using them to reference <em><acronym title="HyperText Markup Language">HTML</acronym> elements</em> does. Though untested, the cognitive load might actually be even less since the <acronym title="Cascading Style Sheets">CSS</acronym> delegation&#8217;s references could be in the same (style sheet) file.</p>
<p>Moreover, delegation will increase the likelihood of document reusability by enabling style sheets to be more self-describing, more self-referential, in a similar way as good markup is. It satisfies a very fundamental need that designers have to define graphical relationships between elements. At the same time, it does so in a way that is natural to both their way of thinking and beneficial to the separation of concerns principle on which the &#8220;web stack&#8221; (the trifecta of <acronym title="HyperText Markup Language">HTML</acronym>, <acronym title="Cascading Style Sheets">CSS</acronym>, and JavaScript) is based.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/12/14/why-css-needs-delegation-capabilities-and-not-variables/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>How web designers can do their own HTML/CSS: Read Foundation Website Creation</title>
		<link>http://maymay.net/blog/2008/07/21/how-web-designers-can-do-their-own-htmlcss/</link>
		<comments>http://maymay.net/blog/2008/07/21/how-web-designers-can-do-their-own-htmlcss/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 14:22:19 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hypertext Copywriting]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Maymay Media]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[Writing and blogging]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=476</guid>
		<description><![CDATA[Last month, 37signals published a short but sweet post about why web designers should do the HTML/CSS implementations for their own designs. The bottom line is, as we&#8217;ve all been saying for a long time now, that the Web is not the same kind of medium as other mediums like print. It is a fundamentally [...]]]></description>
			<content:encoded><![CDATA[<p>Last month, 37signals published a short but sweet post about why <a href="//www.37signals.com/svn/posts/1066-web-designers-should-do-their-own-htmlcss">web designers should do the <acronym title="HyperText Markup Language">HTML</acronym>/CSS implementations for their own designs</a>. The bottom line is, as we&#8217;ve all been saying for a long time now, that the Web is not the same kind of medium as other mediums like print. It is a fundamentally different kind of canvas than most web designers are used to using. As a result, if you as a web designer are not intimately familiar with it, you&#8217;re not going to do great work.</p>
<blockquote cite="//www.37signals.com/svn/posts/1066-web-designers-should-do-their-own-htmlcss"><p>designing for the web is a lot less about making something dazzle and a lot more about making it work. The design decisions that matter pertain directly to the constraints of the materials. What form elements to use. What font sizes. What composition. What flow. Those decisions are poorly made at an arm’s length.</p>
<p>I’ve worked with many web designers in the past who only did abstractions and then handed over pictures to be chopped and implemented by “<acronym title="HyperText Markup Language">HTML</acronym> monkeys”. It never really gelled well. The things that got strong attention were all the things that Photoshop did well. Imagery, curvy lines, and the frame. All the <em>around</em> stuff, never the <em>it</em> stuff.</p></blockquote>
<p>In other words, to do great web design you have to design <em>in</em> the Web, not in some other medium <em>for</em> the Web. I mean, serious magazine firm employs designers who don&#8217;t understand how to work with page layout programs like InDesign. Why, then, do so many web design agencies employ designers who don&#8217;t know how to work with web technologies, or even how to use programs like Dreamweaver? It doesn&#8217;t really make any sense, and it&#8217;s no wonder that the resulting implementation is rarely top-notch work.</p>
<p>But if you&#8217;re a graphic designer who doesn&#8217;t know much about Web technologies, what are you to do? Well, as a first step, I think you should pick up my new book, <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.com%2FFoundation-Website-Creation-XHTML-JavaScript%2Fdp%2F1430209917%2F&#038;tag=maymaydotnet-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=9325">Foundation Website Creation</a><img src="http://www.assoc-amazon.com/e/ir?t=maymaydotnet-20&amp;l=ur2&amp;o=1" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />. It&#8217;s available from all good booksellers (and probably some crappy ones) as of today. The book is targeted towards all manner of web professionals, including graphic designers and website producers, who want to learn more about what it takes to actually implement a site.</p>
<p>If I do say so myself, the chapters on <acronym title="eXtensible HyperText Markup Language; HTML reformulated as XML">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> are exceptionally thorough. The book <em>doesn&#8217;t</em> try to turn you into an exceptional programmer. Instead, it will explain the foundational concepts you need to know to <em>understand how <acronym title="eXtensible HyperText Markup Language; HTML reformulated as XML">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> actually work</em>, and in so doing will enable you to use the tools you already know to solve problems and get things done.</p>
<p>I think this book will be an excellent starting point for lots of designers and other web professionals. However, it is not going to take you from zero to hero—no book can. That&#8217;s why I recommend that, after you read <cite>Foundation Website Creation</cite> and have a solid grasp of what the technology can do for you and how it actually does it, you next take a look at these excellent books:</p>
<ul>
<li><a href="http://domscripting.com/book/"><acronym title="Document Object Model">DOM</acronym> Scripting by Jeremy Keith</a> — if you&#8217;re a designer that needs to add a behavioral layer with JavaScript and Ajax to your pages, you need to read this book next.</li>
<li><a href="http://www.amazon.com/Mastering-Dreamweaver-Voices-That-Matter/dp/0321508971">Mastering <acronym title="Cascading Style Sheets">CSS</acronym> with Dreamweaver CS3</a> &#8211; if you&#8217;re familiar with Dreamweaver and want to keep using it to create standards-based web sites, then I recommend you follow <cite>Foundation Website Creation</cite> with this book by <a href="//w3conversions.com/">Stephanie Sullivan</a> and Greg Rewis to take your Dreamweaver skills to the next level.</li>
</ul>
<p>As always, most of all, have fun. Because if you&#8217;re not having fun, you&#8217;re not going to make good web sites no matter what you know.</p>
<p><strong>Note:</strong> As of this writing, the book listing on Amazon still publishes the wrong author list, which is very frustrating but out of my hands. At least the image of our book&#8217;s front cover lists the correct authors.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/07/21/how-web-designers-can-do-their-own-htmlcss/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>I&#8217;m getting a book published and it&#8217;s called Foundation Website Creation</title>
		<link>http://maymay.net/blog/2008/05/19/im-getting-a-book-published-and-its-called-foundation-web-standards/</link>
		<comments>http://maymay.net/blog/2008/05/19/im-getting-a-book-published-and-its-called-foundation-web-standards/#comments</comments>
		<pubDate>Mon, 19 May 2008 13:50:36 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Maybe Maimed]]></category>
		<category><![CDATA[Maymay Media]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[Writing and blogging]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=436</guid>
		<description><![CDATA[For those who have been wondering what is keeping me so busy these days, the answer is that I&#8217;m working on the final stages of a book that is getting published as one of three co-authors. Not only am contributing three chapters (the technical chapters on (X)HTML and CSS, specifically), but I am also technically [...]]]></description>
			<content:encoded><![CDATA[<p>For those who have been wondering what is keeping me so busy these days, the answer is that I&#8217;m working on the final stages of a book that is getting published as one of three co-authors. Not only am contributing three chapters (the technical chapters on (X)<acronym title="HyperText Markup Language">HTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym>, specifically), but I am also technically reviewing the entire book.</p>
<p>My co-authors on the book, called <a href="//www.friendsofed.com/book.html?isbn=9781430209911"><cite><del datetime="2008-06-15T10:43:08+00:00">Foundation Web Standards</del> <ins datetime="2008-06-15T10:43:08+00:00">Foundation Website Creation</ins></cite></a> (you can <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.com%2FFoundation-Website-Creation-XHTML-JavaScript%2Fdp%2F1430209917%2F&#038;tag=maymaydotnet-20&#038;linkCode=ur2&#038;camp=1789&#038;creative=9325" title="Buy on Amazon.com.">pre-order now</a>) and published by <a href="//friendsofed.com/">Friends of ED</a>, an <a href="//apress.com/">Apress</a> company, are <a href="//industryinteractive.net/">Jonathan Lane of Industry Interactive, Inc.</a> and <a href="//www.sanbeiji.com/">Joe Lewis, who blogs at Sanbeiji.com</a>. I&#8217;m not going to say much more until after the book is released in late July.</p>
<p>For the eager, here&#8217;s the description of the book posted on the Friends of ED website:</p>
<blockquote cite="//www.friendsofed.com/book.html?isbn=9781430209911"><p>Foundation Website Creation explores the process of constructing a web site from start to finish. There is more to the process than just knowing <acronym title="HyperText Markup Language">HTML</acronym>! Designers and developers must follow a proper process to flush out goals and objectives and determine requirements both prior to, and during project development.</p>
<p>Large Web projects are rarely completed by a single person. Producers, project managers, designers, developers, writers, and editors all play critical parts in a project&#8217;s evolution. This book provides an overview of the entire process, and also shows project development from the perspective of these different roles. It introduces the key concepts and duties performed by every member of such a team, and gives you the skills necessary to tackle projects like a professional.</p></blockquote>
<p>It&#8217;s quite exciting getting a book out, and it&#8217;s quite a bit more work than I&#8217;d have ever originally thought. That being said, it&#8217;s extremely rewarding. There&#8217;s a lot more work I need to do on it between now and the time it gets released to publishing, so, well…back to work I go.</p>
<p>Now you all know where I&#8217;ve been spending my time writing.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/05/19/im-getting-a-book-published-and-its-called-foundation-web-standards/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Window and Element Resizing Annoyances in Internet Explorer</title>
		<link>http://maymay.net/blog/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/</link>
		<comments>http://maymay.net/blog/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/#comments</comments>
		<pubDate>Thu, 24 May 2007 22:30:21 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/archives/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/</guid>
		<description><![CDATA[This has been an interesting day. In less than 8 hours, I&#8217;ve had to tackle the following IE nuisances: document.body vs. document.documentElement In IE 6, in order to access the current width of the window in JavaScript you need to get document.body.clientWidth only if you&#8217;re in quirks mode. If you&#8217;re in standards mode, this property [...]]]></description>
			<content:encoded><![CDATA[<p>This has been an interesting day. In less than 8 hours, I&#8217;ve had to tackle the following <acronym title="Internet Explorer">IE</acronym> nuisances:</p>
<h3><code>document.body</code> vs. <code>document.documentElement</code></h3>
<p>In <acronym title="Internet Explorer">IE</acronym> 6, in order to access the current width of the window in JavaScript you need to get <code>document.body.clientWidth</code> only if you&#8217;re in quirks mode. If you&#8217;re in standards mode, this property not only still exists, but it means something entirely different! It instead refers to the width of the <code>body</code> element.</p>
<p>This causes real trouble for some scripts when the value of the this variable seems to suddenly become frozen or fixed at a single value instead of changing appropriately on a window resize event. Instead of <code>document.body.clientWidth</code>, in standards mode, use <code>document.documentElement.clientWidth</code>. (<a href="http://www.quirksmode.org/js/doctypes.html" title="View QuirksMode's compatibility table.">Reference table at QuirksMode.org</a>)</p>
<h3>Internet Explorer crashes when attempting <code>min-width</code></h3>
<p>If you use <acronym title="Internet Explorer">IE</acronym>&#8216;s proprietary <code>expression()</code> syntax to script a <acronym title="Cascading Style Sheets">CSS</acronym> value, beware of calculating widths or heights that exactly match the value you&#8217;d like to set. If you do something like the following to set a minimum width on <code>#someElement</code>, <acronym title="Internet Explorer">IE</acronym> will crash when you actually resize that element to be 500 pixels wide.</p>
<pre>#someElement { width: expression(document.body.clientWidth &lt; <var>500</var> ? "500px" : "auto"); }</pre>
<p>Instead of doing the above, you should check for <em>almost</em> exactly the size you want, like so:</p>
<pre>#someElement { width: expression(document.body.clientWidth &lt; <var>501</var> ? "500px" : "auto"); }</pre>
<p>However, the really important thing to keep in mind is that the minimum width you&#8217;re testing (<em>501</em> in that second case) needs to be at least one pixel greater than the <strong>total content <em>and</em> padding width</strong> of the element. So if you have an element that needs to be no less than 500 pixels wide but also has 10 pixels of left and right padding, you need to check not for 501 pixels in width, but rather for 521 pixels in width. (<a href="http://www.cameronmoll.com/archives/000892.html" title="Fixed: IE 6 min/max width hack">Reference on CameronMoll.com.</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2007/05/24/window-and-element-resizing-annoyances-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making code maintainable: mind your edit-per-change ratio</title>
		<link>http://maymay.net/blog/2007/04/13/making-code-maintainable-mind-your-edit-per-change-ratio/</link>
		<comments>http://maymay.net/blog/2007/04/13/making-code-maintainable-mind-your-edit-per-change-ratio/#comments</comments>
		<pubDate>Fri, 13 Apr 2007 19:48:15 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/archives/2007/04/13/making-code-maintainable-mind-your-edit-per-change-ratio/</guid>
		<description><![CDATA[One of the most fundamental problems when dealing with the world on any level, whether your issue is technological, physical, or conceptual, is handling change. People are fond of saying that the only constant in the world is that things will change. That&#8217;s certainly true, but that nugget of wisdom doesn&#8217;t actually tell us what [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most fundamental problems when dealing with the world on any level, whether your issue is technological, physical, or conceptual, is handling change. People are fond of saying that the only constant in the world is that things will change. That&#8217;s certainly true, but that nugget of wisdom doesn&#8217;t actually tell us what to do about all these inevitable changes.</p>
<p>In some industries, such as construction (for example), people are very careful about what they do because they know how hard it will be to change something after the fact. In the digital workplace, however, people don&#8217;t seem to think as much about this sort of thing because it&#8217;s relatively easy to change things. After all, everyone&#8217;s dealing in bits and bytes at a fundamental level. However, if you take a higher-level look, you&#8217;ll see that many times things are not as easy to change <em>correctly</em> as you might think, and the costs associated with these mistakes and after-the-fact edits can be enormous.</p>
<p>Take a web site, for instance. (I bet you saw that coming.) After a web site is launched (and even before, sometimes), changes have to go back and forth between designers and coders, production and design, and back again. Many times so-called final versions are just the next revision and not actually set in stone, no matter what anyone says. For a web developer, all these changes can be really troublesome, however they also provide an opportunity for rapid, iterative improvement of your (X)<acronym title="HyperText Markup Language">HTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> code.</p>
<p>In a recent project I worked on, I found myself faced with the challenge of positioning two columns of data that each had a different number of elements inside of them but that ultimately had to be the exact same total height. My production manager, who fell in love with floated layouts a long time ago, wanted to position the page using one column floated left and the other floated right, with their dimensions fixed so as to give them both room to fit inside their parent. This seemed perfectly logical to me, so I implemented it that way.</p>
<p>As the project moved forward, however, I realized that in our design changes to this kind of floated layout would require a minimum of editing two files. First, we&#8217;d need to edit the <acronym title="HyperText Markup Language">HTML</acronym> source of our page to change the order of the content boxes inside the floated columns, and second we&#8217;d need to change the dimensions of the elements in our style sheets. Instead, reimplementing the design with absolute positioning would require edits to only one source file, the style sheet itself, where both the position and the element dimensions could be specified in a single <acronym title="Cascading Style Sheets">CSS</acronym> declaration.</p>
<p>With all the frequent changes the design department was making, this argument ultimately won everyone over, and the site uses absolute positioning for the design. The key concept to take away from this experience is that part of making things easy in the future is to design with change in mind, to be as flexible as possible from the get-go, but also to think about the actual implementations in such a way as to lower your edit-per-change ratio as much as possible. The fewer things you have to change, the easier it will be to change things moving forward.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2007/04/13/making-code-maintainable-mind-your-edit-per-change-ratio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Resource for IE&#8217;s Mysterious &#8216;hasLayout&#8217; Property</title>
		<link>http://maymay.net/blog/2006/01/11/css-resource-for-ies-mysterious-haslayout-property/</link>
		<comments>http://maymay.net/blog/2006/01/11/css-resource-for-ies-mysterious-haslayout-property/#comments</comments>
		<pubDate>Wed, 11 Jan 2006 09:43:52 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Goodies]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/archives/2006/01/11/css-resource-for-ies-mysterious-haslayout-property/</guid>
		<description><![CDATA[I recently discovered (and devoured) this excellent essay on Internet Explorer&#8217;s hasLayout property, which every web designer who struggles to understand IE needs to read. It&#8217;s probably the clearest an most complete article out there on why certain bugs affect IE the way they do. A definite must read that should cut down on your [...]]]></description>
			<content:encoded><![CDATA[<p>I recently discovered (and devoured) this excellent <a href="http://www.satzansatz.de/cssd/onhavinglayout.html" title="">essay on Internet Explorer&#8217;s <code>hasLayout</code> property</a>, which every web designer who struggles to understand <acronym title="Internet Explorer">IE</acronym> needs to read. It&#8217;s probably the clearest an most complete article out there on <em>why</em> certain bugs affect <acronym title="Internet Explorer">IE</acronym> the way they do. A definite must read that should cut down on your bug-hunting time and make you a better cross-browser web designer.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2006/01/11/css-resource-for-ies-mysterious-haslayout-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Amazon Guide: So You&#8217;d Like To Become a Front-End Web Design Guru</title>
		<link>http://maymay.net/blog/2005/12/23/amazon-guide-become-a-web-design-guru/</link>
		<comments>http://maymay.net/blog/2005/12/23/amazon-guide-become-a-web-design-guru/#comments</comments>
		<pubDate>Fri, 23 Dec 2005 16:13:34 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Business & E-Commerce]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Web Accessibility]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=291</guid>
		<description><![CDATA[I've made what I think is a rather nice Amazon Guide. Laugh if you must, but I wanted to see what creating one would be like. Naturally, I decided to write a brief guide to becoming a front-end web design guru.]]></description>
			<content:encoded><![CDATA[<p>With a bit of free time over breakfast, I was fiddling with my personal site and looking over my bookshelf. I decided to make an Amazon guide to &ldquo;becoming a front-end web design guru&rdquo; based on many of the books in my ever-expanding collection. So without further ado, here it is, my guide to becoming a front-end web-design guru, featuring the most varied and useful set of 20 books I have ever read:</p>
<h3 style="clear:left;">The Grim Truth</h3>
<p>Let&#8217;s face it. These days, any Joe-shmo with Microsoft FrontPage can call himself a web developer or designer. But web surfers can tell the difference between a professionally designed site and a site designed by your dentist&#8217;s brother&#8217;s roommate&#8217;s best friend&#8217;s boyfriend. To be professional, you have to design with web standards in mind, focusing on usability and accessibility. And it has to look good &mdash; really good.</p>
<h3 style="clear:left;">The Tools You&#8217;ll Use</h3>
<p>First, you&#8217;re going to need to stock your toolbox. Start with the basics. Learn how to manipulate page layouts with (X)<acronym title="HyperText Markup Language">HTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> by reading <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=073571245X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/073571245X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Eric Meyer on CSS: Mastering the Language of Web Design</a>. Occasionally, you&#8217;ll need a dash of <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0735711674%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0735711674%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">JavaScript Design</a>. Finally, learn what works best by <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=156205810X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/156205810X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Designing Web Usability : The Practice of Simplicity</a>.</p>
<ul>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=073571245X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/073571245X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/073571245X.01._SCMZZZZZZZ_.jpg" alt="Eric Meyer on CSS: Mastering the Language of Web Design" /></a></li>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=156205810X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/156205810X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/156205810X.01.IN07._SCMZZZZZZZ_.jpg" alt="Designing Web Usability : The Practice of Simplicity" /></a></li>
</ul>
<h3 style="clear:left;">Building It Right</h3>
<p><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0321303474%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0321303474%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">The Zen of <acronym title="Cascading Style Sheets">CSS</acronym> Design : Visual Enlightenment for the Web (Voices That Matter)</a> is possible for you! Building professional web sites means <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=073571150X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/073571150X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Building Accessible Websites (With <acronym title="Compact Disc">CD</acronym>-<acronym title="Read Only Memory">ROM</acronym>)</a>. No matter how good your design may be, it won&#8217;t mean anything if it doesn&#8217;t load quickly, so don&#8217;t forget to always <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0735713243%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0735713243%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Speed Up Your Site: Web Site Optimization</a>. Then put it all together to create <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0321346939%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0321346939%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Bulletproof Web Design : Improving flexibility and protecting against worst-case scenarios with <acronym title="eXtensible HyperText Markup Language; HTML reformulated as XML">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym></a>. But you&#8217;re not done yet! Help people find your site by giving it <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0735712565%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0735712565%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Search Engine Visibility</a>.</p>
<ul>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=073571150X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/073571150X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/073571150X.01._SCMZZZZZZZ_.jpg" alt="Building Accessible Websites (With CD-ROM)" /></a></li>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0735713243%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0735713243%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/0735713243.01._SCMZZZZZZZ_.jpg" alt="Speed Up Your Site: Web Site Optimization" /></a></li>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0321303474%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0321303474%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/0321303474.01._SCMZZZZZZZ_.jpg" alt="The Zen of CSS Design : Visual Enlightenment for the Web (Voices That Matter)" /></a></li>
</ul>
<h3 style="clear:left;">Really Good References</h3>
<p>While you&#8217;re doing all these things, don&#8217;t be afraid to let curiosity get the better of you. Expand upon the projects in the previous books by doing things differently, doing things your own way. As you tinker, you&#8217;ll come across situations in which you don&#8217;t know how to do something. For those situations, use the following must-have references to quickly look up information about a particular technology.</p>
<p>For (X)HTML: <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=059600382X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/059600382X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><acronym title="HyperText Markup Language">HTML</acronym> &#038; XHTML: The Definitive Guide, Fifth Edition</a><br />
For CSS: <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0596005253%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0596005253%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Cascading Style Sheets: The Definitive Guide, 2nd Edition</a> and <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0596005768%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0596005768%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><acronym title="Cascading Style Sheets">CSS</acronym> Cookbook</a><br />
For JavaScript: <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=1565923928%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1565923928%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">JavaScript Definitive Guide</a></p>
<ul>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=059600382X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/059600382X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/059600382X.01._SCMZZZZZZZ_.jpg" alt="HTML &#038; XHTML: The Definitive Guide, Fifth Edition" /></a></li>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0596005253%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0596005253%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/0596005253.01._SCMZZZZZZZ_.jpg" alt="Cascading Style Sheets: The Definitive Guide, 2nd Edition" /></a></li>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0596005768%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0596005768%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/0596005768.01._SCMZZZZZZZ_.jpg" alt="CSS Cookbook" /></a></li>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=1565923928%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1565923928%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/1565923928.01._SCMZZZZZZZ_.jpg" alt="JavaScript Definitive Guide" /></a></li>
</ul>
<h3 style="clear:left;">Helpful Bonus Books</h3>
<p>Read <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0975240269%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0975240269%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">The JavaScript Anthology : 101 Essential Tips, Tricks &#038; Hacks</a> to learn even more about what you can do with JavaScript and how to solve real-world problems with DHTML. Get more usability insight from <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=073571102X%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/073571102X%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Homepage Usability: 50 Websites Deconstructed</a> and <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0321344758%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0321344758%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Don&#8217;t Make Me Think : A Common Sense Approach to Web Usability (2nd Edition)</a>. Arm yourself with an arsenal of <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=1590593812%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1590593812%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Web Standards Solutions: The Markup and Style Handbook (Pioneering Series)</a> to take on <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=1581153163%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1581153163%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">The Real Business of Web Design</a>.</p>
<ul>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=1590593812%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1590593812%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://ec1.images-amazon.com/images/P/1590593812.01._SCMZZZZZZZ_.jpg" alt="Web Standards Solutions: The Markup and Style Handbook (Pioneering Series)" /></a></li>
<li style="list-style:none;float:left;margin: .5em;padding:.5em;border:1px solid silver;"><a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0321344758%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0321344758%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon"><img src="http://images.amazon.com/images/P/0321344758.01._SCMZZZZZZZ_.jpg" alt="Don\'t Make Me Think : A Common Sense Approach to Web Usability (2nd Edition)" /></a></li>
</ul>
<p>Learn all the <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=1568303823%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1568303823%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">Secrets of Successful Web Sites</a> if you&#8217;re involved with larger-scale project management, or if you&#8217;re of the entrepeneurial bent, find out <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0762727896%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0762727896%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">How to Start a Home-Based Web Design Business, 2nd (Home-Based Business Series)</a> or <a href="http://www.amazon.com/exec/obidos/redirect?tag=maymaydotnet-20%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=0814471390%2526tag=maymaydotnet-20%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/0814471390%25253FSubscriptionId=0EMV44A9A5YT1RVDGZ82" title="View product details at Amazon">How to Be a Successful Internet Consultant</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/12/23/amazon-guide-become-a-web-design-guru/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Safari Crashes on Certain CSS-Generated Content</title>
		<link>http://maymay.net/blog/2005/12/10/safari-crashes-on-certain-css-generated-content/</link>
		<comments>http://maymay.net/blog/2005/12/10/safari-crashes-on-certain-css-generated-content/#comments</comments>
		<pubDate>Sat, 10 Dec 2005 20:48:02 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">/?p=279</guid>
		<description><![CDATA[While doing some design work for a client today, I found a rather peculiar bug in the Safari rendering engine that causes the browser to crash.]]></description>
			<content:encoded><![CDATA[<p>While doing some design work for a client today, I found a rather peculiar bug in the Safari rendering engine that causes the browser to crash. I&#8217;m not sure if this is already a known issue or not, but in either case I&#8217;ve developed a short <a href="http://maymay.net/tests/css/bugs/safari/css-generated-content-reflow-crash/index.html" title="View the example demonstration of the Safari bug.">demonstration page</a> to showcase when the bug is present.</p>
<p>In brief, whenever <acronym title="Cascading Style Sheets">CSS</acronym>-generated content causes a line to reflow beyond the boundaries of its inline box (that is, whenever the text flows past a single line and on to two or more lines) and is then removed again, Safari&#8217;s rendering engine doesn&#8217;t know how to handle the situation and crashes the browser. This situation is esoteric enough that most site designs won&#8217;t have anything to worry about, but if you are trying to use such an effect in Safari then it&#8217;s important to be aware that you may end up crashing your visitor&#8217;s browser.</p>
<p>Rather than crash their entire browser (which certainly won&#8217;t earn your site any brownie points), hide the offending <acronym title="Cascading Style Sheets">CSS</acronym> rule from Safari by using the <a href="http://www.saila.com/attic/sandbox/filters/language_pseudo-class.html" title="Hide rules from Safari and Opera with the language pseudo-class filter.">language pseudo-class filter</a> or similar.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/12/10/safari-crashes-on-certain-css-generated-content/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why Web Pages Need Not Be Compressed</title>
		<link>http://maymay.net/blog/2005/03/27/why-web-pages-need-not-be-compressed/</link>
		<comments>http://maymay.net/blog/2005/03/27/why-web-pages-need-not-be-compressed/#comments</comments>
		<pubDate>Sun, 27 Mar 2005 08:51:22 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Site Optimization]]></category>

		<guid isPermaLink="false">/?p=216</guid>
		<description><![CDATA[If your CSS is so large you think you need to compress it to increase your web site's speed, then quite frankly, you're not using CSS properly.]]></description>
			<content:encoded><![CDATA[<p>There has long been <a href="http://www.fiftyfoureleven.com/sandbox/weblog/2004/jun/the-definitive-css-gzip-method/" title="One method for compressing style sheets.">some talk</a> about compressing <acronym title="Cascading Style Sheets">CSS</acronym> files to make them smaller and thus use less bandwidth. While compressing files transffered over <acronym title="HyperText Transfer Protocol">HTTP</acronym> is all well and good, some people have taken the ability to do this as a license to create badly-designed, bloated style sheets that inevitably turn into nightmares. What these people don&#8217;t realize is that optimized <em>web pages shouldn&#8217;t need to be compressed</em>.</p>
<p><ins datetime="2005-03-28T00:50:00+0500">
<p>(It should be noted that the folks over at FiftyFourEleven are not folks whom I believe are using <acronym title="Cascading Style Sheets">CSS</acronym> improperly. The referenced article merely provides additional information for compression techniques.)</p>
<p></ins></p>
<p>When <a href="/maymaymedia/services/web-site-optimization/" title="I perform speed optimizations on web sites as a service offered by Maymay Media.">I optimize web sites</a>, utilizing <acronym title="HyperText Transfer Protocol">HTTP</acronym> compression techniques (especially with <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>) is one of the <em>last</em> steps I take and sometimes it isn&#8217;t even necessary at all. <strong>If your <acronym title="Cascading Style Sheets">CSS</acronym> is so large you think you need to compress it, then quite frankly, you&#8217;re not using <acronym title="Cascading Style Sheets">CSS</acronym> properly.</strong></p>
<p>It&#8217;s very, very rare that even large web sites&#8217; <acronym title="Cascading Style Sheets">CSS</acronym> files will ever get so big that they need compression if they are written properly the first time. (I&#8217;m talking like 25 kilobytes and up here, and even that&#8217;s not considered &ldquo;huge.&rdquo;) Why is this? Because good <acronym title="Cascading Style Sheets">CSS</acronym> should include a couple of distinct characteristics which cuts down on their size <em>dramatically</em>:</p>
<ul>
<li>High-level <acronym title="Document Object Model">DOM</acronym> selectors should be used to take advtange of <acronym title="Cascading Style Sheets">CSS</acronym> inheritance.</li>
<li>Duplicated and default-declaration rules should be omitted and grouped (as should selectors).</li>
<li>Shorthand properties and value replication should be utilized as often as possible.</li>
<li>Use the cascade to supply global rules for alternative styles and medias (screen, print, etc.).</li>
</ul>
<p>Finally, <strong><acronym title="Cascading Style Sheets">CSS</acronym> is cached</strong> (or should be). That means it&#8217;s only sent down the pipe on the first request for it, and using modularized <acronym title="Cascading Style Sheets">CSS</acronym> by following the above guidelines means you can re-use these cached files over and over again in many different ways <em>without using a touch more bandwidth</em>.</p>
<p>Thus, it is always a bad idea to rely on compression rather than to do things right the first time. (Band-aids don&#8217;t actually correct technological problems.) Thinking that it doesn&#8217;t matter how much code you write because you&#8217;re going to compress it anyway is foolish (though frighteningly common), and can cause serious problems later on in the course of maintaining and updating or redesigning a web site.</p>
<p>Furthermore, some of the main reasons some sites take so long to show up on a user&#8217;s display has very little to do with bandwidth. For instance:</p>
<ul>
<li>Complex tables will tax a user&#8217;s CPU by forcing the browser to perform many calculations to configure the table&#8217;s display area, slowing rendering speed.</li>
<li>To make matters worse, in many cases browsers can&#8217;t display any part of a table until the whole table has been processed. If your entire page is contained within one big table, then you&#8217;re going to make people wait for <em>the entire page</em> to finish being processed. (Ouch.)</li>
<li>On the same note, really long pages can quickly turn into usability nightmares for other reasons, as <a href="/maymaymedia/blog/archives/2005/03/11/css-target-relevance/" title="What you can do to help maintain a smooth browsing experience on your site.">users easily lose their initial context and relevance</a>, so it is advised to limit the vertical length of most web pages for usability as well as optimization reasons.</li>
<li>Page load time increases exponentially for each distinct object (like images, multi-media, even JavaScripts and style sheets) that you place on a page. Reducing the number of <acronym title="HyperText Transfer Protocol">HTTP</acronym> requests is far more important than compressing the content of <acronym title="HyperText Transfer Protocol">HTTP</acronym> transactions because a delay caused by network latency is indefinite.</li>
</ul>
<p>So what have we learned? If you&#8217;re <em>really</em> that concerned with the bandwidth your <acronym title="Cascading Style Sheets">CSS</acronym> (or <acronym title="HyperText Markup Language">HTML</acronym>) is eating up, I&#8217;m not going to tell you not to compress it, but I am going to tell you that you should probably be dealing with other, more pressing concerns. Let&#8217;s talk image optimization, for instance! That, however, is a discussion for another time.</p>
<p>The bottom line is that <acronym title="Cascading Style Sheets">CSS</acronym> was designed with bandwidth in mind. Using <acronym title="Cascading Style Sheets">CSS</acronym> intelligently drastically cuts your bandwidth use which saves you money and headaches because it reduces code bloat for both style sheets and <acronym title="HyperText Markup Language">HTML</acronym> files. <acronym title="HyperText Transfer Protocol">HTTP</acronym> compression is great and useful, but not as a band-aid to fix a problem it can&#8217;t solve.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/03/27/why-web-pages-need-not-be-compressed/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>14 Hour Coding Session</title>
		<link>http://maymay.net/blog/2005/03/19/14-hour-coding-session/</link>
		<comments>http://maymay.net/blog/2005/03/19/14-hour-coding-session/#comments</comments>
		<pubDate>Sun, 20 Mar 2005 00:13:59 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Bipolar Disorder & Moods]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Geeky]]></category>
		<category><![CDATA[Mania & Joy]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">/?p=211</guid>
		<description><![CDATA[omg14hourcodingsession. tirednow.]]></description>
			<content:encoded><![CDATA[<p>Oh my god, fourteen hours playing with <acronym title="eXtensible HyperText Markup Language; HTML reformulated as XML">XHTML</acronym>, <acronym title="Cascading Style Sheets">CSS</acronym>, and <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym> to get <a href="http://maymaymedia.com/" title="A much expanded and still incomplete business web site.">Maymay Media</a> to what it is now. (And it&#8217;s still not done, though I&#8217;m constantly looking for <a href="http://www.maymay.net/maymaymedia/contact/" title="Would you send me feedback on my web site?">feedback</a>!)</p>
<p>Much, if not most of that time was spent writing and editting new content, and beating down <acronym title="Cascading Style Sheets">CSS</acronym> bugs in Internet Explorer. Those of you who know my work habits are likely to be surprised by the fact that I could spend 14 hours dealing mostly with client-side coding issues.</p>
<p>Normally I can&#8217;t spend more than a few hours&mdash;at the most&mdash;dealing with <acronym title="Cascading Style Sheets">CSS</acronym> problems because browser bugs tick me off too much. (Ahem, Micro<em>Sucks</em>.) Nevertheless, for some miraculous reason, I kept swatting bug after bug after bug this session and the enthusiasm just fueled more coding. Needless to say, I was very <em>very</em> productive last night.</p>
<p>I also didn&#8217;t sleep a wink, however, so now I&#8217;m dead tired. Here&#8217;s a short recap before my memories fall down behind the waterfall in my mind.</p>
<h3>Last Night&#8217;s Call-a-thon and Digital Departure</h3>
<ul>
<li>
<p>Last night I was Mr. Popular. I got literally countless phone calls (I can&#8217;t remember them all) from folks who wanted to chat it up. I spoke to a few Meetup group members, Danica, my parents, and others. Christine called and wanted to hang out today but she canceled this afternoon. (I didn&#8217;t mind, I&#8217;m exhausted.)</p>
</li>
<li>
<p>Danica came over from about 8:30 PM to 10:30 PM so that she could give me back the apartment keys and transfer her digital posessions (computer files) off of my computers and onto her own. She also gave me a <cite>Moldy Peaches</cite> album to import into my iTunes Library. (Cool.)</p>
<p>So that&#8217;s pretty much it. We said goodbye, she seemed sad, and I asked her to call me so I knew she&#8217;d gotten home okay. She did, and we said goodbye again. And that&#8217;s that; we are finally going our separate ways and have no more connection to each other whatsoever.</p>
<p>I&#8217;m not even thinking about the future, but I do admit that remaining friends is something I&#8217;d probably like&mdash;if it were not emotionally draining. We&#8217;ll see what happens, but the path for right now is very clear: I&#8217;m trekking it solo yet again!</p>
</li>
</ul>
<h3>The Geeky Parts</h3>
<ul>
<li>
<p>Back to the tech realm, I&#8217;ve implemented my <a href="/tests/php/dynamic-target-relevance/?r-msg=Remember+this%3F#dynamic-relevancy-messages" title="The original published proof-of-concept for a relevency messages.">dynamic relevancy message <acronym title="Application Programming Interface">API</acronym></a> on this blog. What does that mean for you? Probably nothing, but it does mean you&#8217;ll likely see relevancy messages change and grow in abundance over time. As always, use a modern browser to see the full effect.</li>
<li>
<p>Still in the tech realm, I squashed a number of annoying <acronym title="Internet Explorer">IE</acronym> <acronym title="Cascading Style Sheets">CSS</acronym> bugs <em>on this blog</em> with the somewhat-magical application of <code>position:relative;</code>. This means visitors using <acronym title="Internet Explorer">IE</acronym> will finally get a near-perfect browsing experience, with no annoying vanishing backgrounds anymore.</p>
</li>
<li>
<p>Also, Google SiteSearch has been implemented, so you&#8217;ll be seeing that on the top banner for the time being. It&#8217;s nothing special, just a way to make it look like you can do more than you can here. It might also make me some more money via clickthroughs, but that&#8217;s unlikely. (Oh, which reminds me, those ads on the right side of the window, yeah, <strong>if you click on those I get money</strong>. Don&#8217;t be shy.)</p>
</li>
<li>
<p>A not-so-new but still interesting point of note is that I&#8217;ve started using <a href="http://www.mybloglog.com/" title="Tracks click counts on your outgoing links, seamlessly, and for free.">MyBlogLog.com</a> to keep track of which hyperlinks people are clicking on. This has been somewhat informative because it means I get to see which hyperlinks induce clicks and which don&#8217;t. Anchor text is important, and this is a useful tool to learn how you can manipulate the effect of a link.</p>
</li>
</ul>
<h3>Flickr Photos from the Past!</h3>
<p>Finally, I&#8217;ve been wanting to get more value out of my digital camera. I haven&#8217;t been taking pictures, but backing up and transfering a bunch of Danica&#8217;s things last night inspired me to dig through some of my old photo collections to see what could turn up. Well, here it is:</p>
<ul>
<li>
<p>Here&#8217;s me almost a year ago, during last year&#8217;s Passover at my mother&#8217;s:</p>
<p><a href="http://www.flickr.com/photos/maymay/6868881/" title="View this photo at my Flickr photostream."><img src="http://photos6.flickr.com/6868881_9516cace64.jpg" width="220" height="297" alt="Me sitting at the table during Passover, 2004" /></a></li>
<li>
<p>Me at San Francisco&#8217;s Exploratorium with Danica during the Summer of 2004, on my trip to meet her family. Look at the face I&#8217;m making, I had so much fun there.</p>
<p><a href="http://www.flickr.com/photos/maymay/6868886/" title="View this photo at my Flickr photostream."><img src="http://photos7.flickr.com/6868886_428cf57250.jpg" width="269" height="384" alt="Me sitting on the big chair at the San Francisco Exploratorium." /></a></li>
<li>
<p>Yeah, I was gonna eat that piece of toast. Obviously, my dinner plans were foiled.</p>
<p><a href="http://www.flickr.com/photos/maymay/6868885/" title="View this photo at my Flickr photostream."><img src="http://photos3.flickr.com/6868885_845fa1d17b.jpg" width="345" height="396" alt="I look at the camera sadly, holding burnt toast in my hands." /></a></li>
<li>
<p>This is what happens to my face if I don&#8217;t shave.</p>
<p><a href="http://www.flickr.com/photos/maymay/6868882/" title="View this photo at my Flickr photostream."><img src="http://photos6.flickr.com/6868882_534ab89a76.jpg" width="252" height="473" alt="Me smiling, sunlight clearly showing my unshaven face." /></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/03/19/14-hour-coding-session/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Targetting Relevance in Long Web Pages with the CSS :target Pseudo-Class</title>
		<link>http://maymay.net/blog/2005/03/11/css-target-relevance/</link>
		<comments>http://maymay.net/blog/2005/03/11/css-target-relevance/#comments</comments>
		<pubDate>Fri, 11 Mar 2005 20:24:47 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Hypertext Copywriting]]></category>
		<category><![CDATA[Information & Communication]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">/?p=199</guid>
		<description><![CDATA[Context and relevance are sometimes lost when linking to pages on the web. Basic HTML and good hypertext copywriting habits (like using <code>title</code> attributes) can help, but not always enough. Here's a totally new method (I think) to embed what I call <dfn>relevancy messages</dfn> into the <em>destination page</em> of a site.]]></description>
			<content:encoded><![CDATA[<h3>The Importance of Context and Relevance</h3>
<p>Context and relevance are two of the most important aspects of effective communication. If the context of a message is not understood then the commuication will likely be disregarded, or worse&mdash;misinterpreted. If the message isn&#8217;t relevant to the topic at hand then it will be useless to everybody involved.</p>
<p>In order to ensure that a message is successfully received and has the desired effect, one must first ensure that the context for that message is properly set up and that the message itself is relevant to the subject matter.</p>
<p>An excellent example of a scenario where a loss of context and/or relevance can easily cause communication problems is receiving email messages. Surely everyone has recieved an email that they simply don&#8217;t know what to do with or why they&#8217;ve gotten it. (By the way, for some unbelievably insightful tips on composing effective email messages, read <a href="http://hbswk.hbs.edu/item.jhtml?id=4438&#038;t=srobbins" title="Tips for Mastering E-Mail Overload">this article</a> [via <a href="http://www.43folders.com/2005/03/stever_robbins_.html" title="43 Folders: Stever Robbins on email overload">43 Folders</a>].)</p>
<p>The same thing can&mdash;and does&mdash;happen on the web. For example, let&#8217;s say you&#8217;re reading a page which has a link in its text to another page. You decide to follow the link but once you&#8217;ve arrived at the new page you find yourself  staring at an enormous amount of other text that doesn&#8217;t have anything to do with why you followed the link in the first place. Suddenly you&#8217;re confused, you feel lost, and you quickly push the &ldquo;Back&rdquo; button of your browser.</p>
<p>What went wrong here? Context was lost; the destination page had no relevance to the source page. If it did, you couldn&#8217;t find it because it wasn&#8217;t clearly identified. This is a confusing and frustrating situation, and one that I&#8217;m willing to bet happens way too often on the web.</p>
<p>On my own blog, I frequently link to entries I&#8217;ve previously written. Sometimes these entries can be quite long, and I&#8217;m not always referencing the entire entry in my link. But by pointing the link to a specific &ldquo;intra-page&rdquo; anchor by using a <a href="http://www.w3.org/DesignIssues/Fragment.html" title="What it is and how to make one.">fragment identifier</a> and clearly marking the relevance of this information in both the link itself (with a descriptive <code>title</code>) <em>and in the landing page</em> (with what I&#8217;ve come to call a <dfn>relevancy message</dfn>), context is preserved and confusion is eliminated.</p>
<p>To see what I&#8217;m talking about in practice, check out <a href="/tests/css/relevant-anchors/1.html" title="An example to show what I'm talking about.">my experiment pages</a>. It&#8217;s a demo of the problem and relevancy messages in action.</p>
<h3><acronym title="Cascading Style Sheets level 2">CSS2</acronym> The Rescue</h3>
<p>There&#8217;s only one problem left. How does one insert text into the landing page which will be viewable when someone follows a <em>specially-crafted</em> link to it, but <em>not</em> when they arrive at the page via any other link? Though it is possible to program this into your pages using <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym> or another web scripting language, <acronym title="Cascading Style Sheets">CSS</acronym> level 2 offers a much simpler and maintainable solution: the <code>:target</code> and <code>:before</code> pseudo-classes.</p>
<p>When used in combination, the <code>:target</code> and <code>:before</code> pseudo-classes can be used to generate text on a page at a specific point in the document when your page is linked to in a certain way. By using an additional <acronym title="Cascading Style Sheets level 2">CSS2</acronym> function, <code>attr()</code>, we can also generate customized text for each landing spot within the document. Let&#8217;s take a look at each component separately.</p>
<h4>The <acronym title="HyperText Markup Language">HTML</acronym> You&#8217;ll Need</h4>
<p>Let&#8217;s say you&#8217;re writing about apples. In your text, you link to a previous article you wrote about oranges. Your link in the article on apples might look like this:</p>
<pre>&lt;a href="oranges.html" title="Oranges have a thick, white pith beneath their skin." &gt;oranges&lt;/a&gt;</pre>
<p>And your text in the article on oranges might look like this:</p>
<pre>&lt;p&gt;[&hellip;] The skin of an orange is thick, porous, and varies in color from deep to light orange. There is a bitter-tasting white pith underneath the outter-most layer of the fruit's skin. [&hellip;]&lt;/p&gt;</pre>
<p>In order to link directly to the paragraph mentioning the orange&#8217;s pith you need to insert a named anchor just after the opening paragraph tag where that content was written. You also need to append this name to the <acronym title="Uniform Resource Identifier">URI</acronym> of the link, as a fragment identifier. The resulting <acronym title="HyperText Markup Language">HTML</acronym> for the link might look like this:</p>
<pre>&lt;a href="oranges.html#skin" title="Oranges have a thick, white pith beneath their skin." &gt;oranges&lt;/a&gt;</pre>
<p>The resulting <acronym title="HyperText Markup Language">HTML</acronym> for the paragraph about oranges might look like this:</p>
<pre>&lt;p&gt;&lt;a id="skin"&gt;&lt;/a&gt;The skin of an orange is thick, porous, and varies in color from deep to light orange. There is a bitter-tasting pith underneath the outter-most layer of the fruit's skin.&lt;/p&gt;</pre>
<h4>The <acronym title="Cascading Style Sheets">CSS</acronym> You&#8217;ll Need</h4>
<p>Once the <acronym title="HyperText Markup Language">HTML</acronym> is in place, you need to create a style rule to generate the text you&#8217;ll want to display before the paragraph. Your style sheet might look like this:</p>
<pre>a:target::before { content: "Here's what I referenced with my link on the last page: "; font-size: larger; font-weight: bold; }</pre>
<p>You can even take it one step further. By adding a <code>title</code> attribute with some helpful text in your named anchor, you can actually display that text (specific to the reference you&#8217;re making) instead of the generic &ldquo;Here&#8217;s what I referenced&hellip;&rdquo; text. The <acronym title="Cascading Style Sheets">CSS</acronym> for that would look like this, and it would display whatever you write as the <code>title</code> for <em>each</em> named anchor you use:</p>
<pre>a:target::before { content: attr(title); }</pre>
<h3>Limitations</h3>
<p>The major drawback to this technique is that you need to change the code of the destination document for it to work. Specifically, you need to insert named anchors (though you can also target <em>any</em> element by giving it an unique <code>id</code>), and you need to insert a style rule. (However, see below for another experiment that will let site owners allow people to get around this limitation.)</p>
<p>Another major drawback is that it requires a fully <acronym title="Cascading Style Sheets level 2">CSS2</acronym>-compliant browser. That means Internet Explorer 5 and 6 (both Macintosh and Windows versions) will not show the special content on the destination page. They will, however, move focus to the point in the document at which the anchor resides.</p>
<h3>Looking to the Future</h3>
<p>I have been playing with this technique recently on my blog (can you find the links I&#8217;ve used this on? ;). The obvious benefit is creating a far more seamless transition from one page to another and maintaining the same context across web pages. This is invaluable for me and my readers in particular, since I tend to enjoy writing and end up writing far longer entries than I probably should. (Even though I use headings to divide my entries into logical chunks, it&#8217;s still good to have another trick up my sleeve to help usability!)</p>
<p>However, this technique is ripe for expansion. For instance, I have created <a href="/tests/php/dynamic-target-relevance/?r-msg=How+you+can+let+anyone+embed+a+relevancy+message%3A%20#concept" title="A proof-of-concept for dynamic relevancy messages in action.">another experiment</a> to dynamically generate the content of the <acronym title="Cascading Style Sheets">CSS</acronym> rule based upon a variable in a <code>GET</code> querystring. (It uses three lines of <acronym title="PHP Hypertext Preprocessor; an HTML-embedded scripting language">PHP</acronym>, and that link itself is a proof-of-concept.) This will allow people to write links that point to my documents and <em>insert their own special relevance-describing blurbs</em> in front of the fragment they&#8217;ve linked to. (Yes, I realize this may pose <acronym title="Cross Site Scripting">XSS</acronym> security problems, I&#8217;m still just playing with the concept.)</p>
<p>Exploring all of this is a lot of fun. The crux of this technique relies upon  accessible and clever hypertext copywriting to enhance usability when linking to web pages and referencing information across pages or, one day, sites. As is the case with most things Web, simple is better.</p>
<p>I&#8217;m very eager to hear about comments on this technique. Are there dangers I haven&#8217;t seen yet? Can you think of another way to use it that I haven&#8217;t mentioned here? Are you already using it on your own site? All feedback welcome. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/03/11/css-target-relevance/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Browser Developer Insight and Nightmares</title>
		<link>http://maymay.net/blog/2005/01/10/browser-developer-insight/</link>
		<comments>http://maymay.net/blog/2005/01/10/browser-developer-insight/#comments</comments>
		<pubDate>Mon, 10 Jan 2005 12:02:10 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">/?p=161</guid>
		<description><![CDATA[Dave Hyatt, a developer of Apple&#8217;s Safari web browser offered some amazingly enlightening insight into the nightmares of browser developers the other day. The only thing I can think to say is: Dave, thanks for trying. This is a great example of how IE&#8216;s inconsistent rendering behavior has long-lasting negative effects on the adoption of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://weblogs.mozillazine.org/hyatt/">Dave Hyatt</a>, a developer of <a href="http://apple.com/safari/">Apple&#8217;s Safari web browser</a> offered some amazingly enlightening insight into the <a href="http://weblogs.mozillazine.org/hyatt/archives/2005_01.html#007252">nightmares of browser developers</a> the other day. The only thing I can think to say is: Dave, thanks for trying.</p>
<p>This is a great example of how <acronym title="Internet Explorer">IE</acronym>&#8216;s inconsistent rendering behavior has long-lasting negative effects on the adoption of <acronym title="Cascading Style Sheets">CSS</acronym> not only by web page authors, but web <em>browser</em> authors. As Dave himself says,</p>
<blockquote cite="http://weblogs.mozillazine.org/hyatt/archives/2005_01.html#007252" title="Dave Hyatt remarks on Internet Explorer's buggy float rendering."><p>So now I really have no choice. This is an example of where the <acronym title="Cascading Style Sheets level 2">CSS2</acronym> standard simply can&#8217;t be followed because buggy layout engines have set a bad precedent that the rest of us have no choice but to follow.</p>
<p>It&#8217;s a shame that Gecko does not do the right thing in strict mode at least, but I suppose they had no choice in the matter either.</p>
</blockquote>
<p>This is reminiscent of back when Opera was beginning to look more and more like Internet Explorer, but at least it&#8217;s not a bug this time.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/01/10/browser-developer-insight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Broken CSS on KVMGalore</title>
		<link>http://maymay.net/blog/2005/01/10/broken-css-on-kvmgalore/</link>
		<comments>http://maymay.net/blog/2005/01/10/broken-css-on-kvmgalore/#comments</comments>
		<pubDate>Mon, 10 Jan 2005 09:03:19 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">/?p=160</guid>
		<description><![CDATA[When shopping for a KVM switch for my up-and-coming computer lab, I came upon one e-commerce site whose broken CSS meant I couldn't use the site! They obviously didn't test on multiple browsers. Don't let this happen to you!]]></description>
			<content:encoded><![CDATA[<p>Tonight I spent much of my time exploring the remains of one of the two PC machines my father gave me for my up-and-coming &ldquo;computer lab.&rdquo; There wasn&#8217;t much of interest on the machine, but as I was looking around the apartment I realized I had more computers than monitors.</p>
<h3>Hardware Countdown</h3>
<p>My oldest machine, an ancient first-generation Apple iMac DV:SE (do you remember those?), obviously contains the <acronym title="Cathode Ray Tube">CRT</acronym> screen along with the computer hardware in one box. So for the most part I consider that one unit. I also have my laptop which falls under the same category, but then I have two PC towers, and I&#8217;m getting ready for yet another from my mother along with a G3 tower soon. All of them are headless.</p>
<p>I only have one stand-alone monitor. So that means up to four computers need to share one monitor. Since I&#8217;m planning on using at least one or two computers as dedicated servers, I&#8217;m not going to need those connected to monitors all the time. For instance, I could <acronym title="Virtual Network Computing">VNC</acronym> in and look around on the rare occasions when I have to. The others, however, are probably going to need something more scalable. I don&#8217;t have the space or the money for more monitors, so the best solution here is undoubtedly a <acronym title="Keyboard, Video and Mouse">KVM</acronym> switch.</p>
<h3>Broken <acronym title="Cascading Style Sheets">CSS</acronym> Can Lead to Unuseable Sites</h3>
<p>As I was browsing, I came upon <a href="http://kvmgalore.com/" title="An online superstore for switches of all kinds."><acronym title="Keyboard, Video and Mouse">KVM</acronym> Galore</a>, retailers of every kind of <acronym title="Keyboard, Video and Mouse">KVM</acronym> switch imagineable. Unfortunately, when I arrived I couldn&#8217;t read any product description because the bottom two-thirds of each line of text was chopped off, disappearing behind a white background. Here&#8217;s a screen shot.</p>
<p><img src="http://maymay.net/images/kvmgalore-bork.jpg" alt="KVMGalore.com's product catalog is unreadable in Gecko-based browsers." style="float: left; padding: 0  10px 10px 0;" /></p>
<p>My first thought was confusion, but my second was to see if I could fix it. So I dived into the source and traced the problem to a <code>&lt;span&gt;&lt;/span&gt;</code> element that was pretending to be a block-level box. Their <acronym title="Cascading Style Sheets">CSS</acronym> had given the span a <code>width</code>, <code>background</code> and <code>border</code>, but no <code>display</code> property.</p>
<p>Without the proper <code>display</code> rule, <acronym title="Cascading Style Sheets">CSS</acronym>-compliant browsers treated the span as an inline element, which is obviously not what the designer had intended. So I <a href="http://www.maymay.net/blog/archives/2004/10/15/view-the-web-your-way-with-edit-css/" title="Learn more about the power of user style sheets in every-day web browsing.">created a local style-sheet of my own</a> and fixed the problem for the duration of my stay on their site. Here is the style sheet I used:</p>
<pre>.detspecs { display: block; }</pre>
<p>Believe it or not, that&#8217;s it. That&#8217;s all it took to fix the problem. I was using Firefox to browse the site, but after a while I became curious about the other browsers. It turns out that the site looks like this on Firefox for Mac, Netscape on both Mac and Windows, and while it&#8217;s <em>mostly</em> better in Safari, nasty black lines cut into the text on that browser as well. Opera 7.5 on both Mac and Windows, along with Internet Explorer 6 for Windows and 5.2 for the Mac looked fine. I&#8217;ve emailed the site owner and hope that they will fix the problem as soon as they can.</p>
<p>This isn&#8217;t the first time an e-commerce site has had broken <acronym title="Cascading Style Sheets">CSS</acronym>. Not long ago <a href="http://www.maymay.net/blog/archives/2004/12/04/user-stylesheets-to-the-rescue/">I wrote</a> about another savvy web developer who fixed the Sainsbury home shopping web site just like I did for <acronym title="Keyboard, Video and Mouse">KVM</acronym> Galore. On the bright side, it&#8217;s good to see <acronym title="Cascading Style Sheets">CSS</acronym> being used more and more thoroughly throughout the online business world.</p>
<p>I still haven&#8217;t chosen a <acronym title="Keyboard, Video and Mouse">KVM</acronym> switch yet as I&#8217;m still researching the topic. If anyone has any advice, I&#8217;d love to hear it.</p>
<p><strong>Update:</strong> I just heard back from the site owner today (January 19<sup>th</sup>), and am glad to see that the <acronym title="Cascading Style Sheets">CSS</acronym> has been fixed. Good job, <acronym title="Keyboard, Video and Mouse">KVM</acronym> Galore!</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2005/01/10/broken-css-on-kvmgalore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User Stylesheets to the Rescue</title>
		<link>http://maymay.net/blog/2004/12/04/user-stylesheets-to-the-rescue/</link>
		<comments>http://maymay.net/blog/2004/12/04/user-stylesheets-to-the-rescue/#comments</comments>
		<pubDate>Sat, 04 Dec 2004 07:21:19 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Apple/Macintosh]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">/?p=138</guid>
		<description><![CDATA[I was just heading to bed (well, kinda) but this was too blogworthy to pass up. Browsing my newsfeeds, I happened upon this post from Andy Budd which points to this Mac OS X Hints post regarding a CSS-savvy web developer trying to do some online shopping. Unfortunately for the online store owners, their pages [...]]]></description>
			<content:encoded><![CDATA[<p>I was just heading to bed (well, kinda) but this was too blogworthy to pass up.</p>
<p>Browsing my newsfeeds, I happened upon <a href="http://www.andybudd.com/archives/2004/11/the_power_of_user_stylesheets/index.php">this post from Andy Budd</a> which points to <a href="http://www.macosxhints.com/article.php?story=2004111417032717">this Mac <acronym title="Operating System">OS</acronym> X Hints post</a> regarding a <acronym title="Cascading Style Sheets">CSS</acronym>-savvy web developer trying to do some online shopping. Unfortunately for the online store owners, their pages are unusable due to a serious rendering bug caused by their stylesheets. But rather than shop elsewhere, <a href="http://roobyroo.dyndns.info/sainsbury/">Lee Noble fixed the problem</a> using a quick user stylesheet applied via Safari.</p>
<p><a href="http://www.maymay.net/blog/archives/2004/10/15/view-the-web-your-way-with-edit-css/">I&#8217;ve said it before</a>, and I&#8217;ll say it again: the Web puts the users in control, the way it always should be!</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/12/04/user-stylesheets-to-the-rescue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centering, Absolute Positioning, and Document Flow</title>
		<link>http://maymay.net/blog/2004/11/20/centering-absolute-positioning-and-document-flow/</link>
		<comments>http://maymay.net/blog/2004/11/20/centering-absolute-positioning-and-document-flow/#comments</comments>
		<pubDate>Sat, 20 Nov 2004 07:08:23 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">/?p=123</guid>
		<description><![CDATA[The question of how to center an absolutely positioned element came up recently in a CSS forum I frequent. It&#8217;s a relatively old question that has several answers, but it&#8217;s been asked often enough imho to warrant a short discussion. CSS has given Web Designers a powerful tool to create breathtaking layouts. However, some things [...]]]></description>
			<content:encoded><![CDATA[<p>The question of how to center an absolutely positioned element came up recently in a <acronym title="Cascading Style Sheets">CSS</acronym> forum I frequent. It&#8217;s a relatively old question that has several answers, but it&#8217;s been asked often enough <acronym title="In My Humble Opinion">imho</acronym> to warrant a short discussion. <acronym title="Cascading Style Sheets">CSS</acronym> has given Web Designers a powerful tool to create breathtaking layouts. However, some things in <acronym title="Cascading Style Sheets">CSS</acronym> have necessitated a change in our workflow. Centering is a great example of such a change.</p>
<h3>Two Forms of Centering in <acronym title="Cascading Style Sheets">CSS</acronym></h3>
<p>There are two kinds of centering that <acronym title="Cascading Style Sheets">CSS</acronym> can accomplish, independant of each other. One kind is center-aligning text, achieved through the use of the <code>text-align</code> property. The other is centering an entire block, and not the text within that block, inside its containing element. We&#8217;ll be talking about the latter.</p>
<h3>Centering a Block-Level Element Using the Document Flow</h3>
<p>In <acronym title="Cascading Style Sheets">CSS</acronym>, to center an element horizontally within its containing block its left and right margins must be set to <code>auto</code>. This will make the element&#8217;s left margin length equal to the length of its right margin, thus keeping the element in the center of its parent. For example, you might center your main content <code>div</code> like this.</p>
<pre>div#content {
    width: 600px; margin: 0 auto;
}</pre>
<p>(The <code>width</code> is necessary; it has nothing to do with being centered, but if you leave it out the <code>div</code> will be as wide as its containing block and will not have any margins to speak of. The margins are what cause the centering effect.)</p>
<p>This will work because the main content <code>div</code> is in the <dfn>flow</dfn> of the document. That is, its margins are &ldquo;pushing against&rdquo; their parent, so they affect the layout of the <code>div</code>.</p>
<h3>Taking the Block Out of the Flow</h3>
<p>But what happens if we take the <code>div</code> <em>out</em> of the flow, with, say <code>position: absolute;</code>?</p>
<pre>div#content {
    width: 600px; margin: 0 auto;
    position: absolute;
}</pre>
<p>Suddenly, we find that the <code>div</code> is no longer centered. This is because we&#8217;ve taken it out of the document flow, out from within its parent element, and now its margins have nothing to push against. So how can we center this element?</p>
<h3>Centering the Absolutely Positioned Box</h3>
<p>The trick is to use its positioning to center <em>one edge</em> of the <code>div</code>, and then use margins relative to its width to push it into center-alignment. Thus, you can center any absolutely positioned element that has a fixed width by giving it, for example, <code>left: 50%</code> and then adding a negative <code>margin-left</code> equal to half of the element&#8217;s width. (You could also use <code>right: 50%</code> and then use a negative <code>margin-right</code> value.)</p>
<pre>div#content {
   width: 600px; margin: 0 0 0 -300px;
    position: absolute; left: 50%;
}</pre>
<p>Now the content <code>div</code> will be centered horizontally in the browser viewport, and it will stay centered even on a window resize.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/11/20/centering-absolute-positioning-and-document-flow/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Observations on the CSS3 Box-Sizing Property and How Designers Use Style Sheets</title>
		<link>http://maymay.net/blog/2004/10/28/observations-on-the-css3-box-sizing-property-and-how-designers-use-style-sheets/</link>
		<comments>http://maymay.net/blog/2004/10/28/observations-on-the-css3-box-sizing-property-and-how-designers-use-style-sheets/#comments</comments>
		<pubDate>Thu, 28 Oct 2004 19:16:49 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">/?p=91</guid>
		<description><![CDATA[Recently, I became aware of CSS3&#8216;s box-sizing property. This property can have two values, content-box and border-box. The content-box value is what we&#8217;re all used to. It causes the selected box&#8217;s dimensions to be sized by setting the specified width of the box equal to the width of the content area of the box. Any [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I became aware of <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym>&#8216;s <code>box-sizing</code> property. This property can have two values, <code>content-box</code> and <code>border-box</code>. The <code>content-box</code> value is what we&#8217;re all used to. It causes the selected box&#8217;s dimensions to be sized by setting the specified <code>width</code> of the box equal to the width of the content area of the box. Any horizontal borders or padding that the box has is then <em>added</em> to the content area&#8217;s width. The <code>border-box</code> value sets the selected box&#8217;s <code>width</code> equal to the content area <em>and</em> any horizontal borders and padding, effectively subtracting the width of the padding and border from the declared <code>width</code> in order to calculate the content area&#8217;s width.</p>
<p>In other words, the <code>border-box</code> value to the <code>box-sizing</code> property makes the selected box use Internet Explorer&#8217;s non-standard box model. At least, it was non-standard until it became part of the <acronym title="Cascading Stlye Sheets level 3">CSS3</acronym> spec. The spec even notes this itself, saying <cite>&ldquo;This is the behavior of width and height as commonly implemented by legacy <acronym title="HyperText Markup Language">HTML</acronym> user agents for replaced elements and input elements.&rdquo;</cite></p>
<p>This is somewhat annoying, because this means that rather than fix their &ldquo;Web browser,&rdquo; Microsoft can now say that their browser supports this property of <acronym title="Cascading Style Sheets">CSS</acronym>. In the end however, I do see the necessity of the property for compatibility reasons, as much as that necessity (caused by one browser vendor&#8217;s lack of support for Web standards) bothers me.</p>
<p>The most direct application of this technique comes in the form of making two child elements who have borders and/or padding fit precisely within one larger parent element whose width is flexible. For example, making floated, columnar layouts.</p>
<p>So while taking all this in I took some time to familiarize myself as best I could with Firefox&#8217;s implementation, the <code>-moz-box-sizing</code> property, and its effects. Some of my observations:</p>
<ol>
<li>
<p>Most interesting uses for <em>three</em> column liquid layouts (or more). Two column layouts can use a (more complicated) balancing of <code>float: left</code> and <code>float: right</code> to achieve a similar effect in a liquid layout, though a small, variable amount of space between columns is nearly unavoidable.</p>
<p>Also, experienced designers usually keep a certain degree of whitespace in their layouts, making such tightly fitted floats largely unnecessary and/or impractical implementations for certain designs. (I.e., positioning would be a more appropriate solution.)</p>
</li>
<li>
<p>Border-boxes offer no help for linking the height of a box to the height of its neighbor. Considering this is the biggest failing of <acronym title="Cascading Style Sheets">CSS</acronym>-based columnar layouts to date, I would stick with an accessible table where absolutely necessary, which <em>can be and often is sized just like a border-box</em>.</p>
</li>
<li>
<p>When confronted with left-floated boxes such as in the case of a columnar layout, <acronym title="Internet Explorer">IE</acronym>/Win versions that use the <code>border-box</code> method of calculating <code>width</code> and <code>height</code> will drop a tightly-fitted floated box below its neighbor on a window resize. This creates either a trippy experience or cause for frustration depending on your mood. Considering this property is at least partially intended to help <acronym title="Internet Explorer">IE</acronym>/Win, that&#8217;s quite an embarassing thing to have happen, methinks.</p>
</li>
<li>
<p>All in all, I&#8217;m still not convinced of the <em>necessity</em> of this property, except to support <acronym title="Internet Explorer">IE</acronym>. While it can certainly be a useful &ldquo;option&rdquo; when attempting to create (arguably simplistic) column layouts using strictly semantic markup and <acronym title="Cascading Style Sheets">CSS</acronym>, tables are still going to be necessary in some designs. In the situations where they are not, a combination of existing techniques can still be used to achieve any desired effect.</p>
</li>
</ol>
<p>Furthermore, this certainly doesn&#8217;t help make <acronym title="Cascading Style Sheets">CSS</acronym> a more approachable topic for Web designers who are new to the technology. The single largest obstacle to <acronym title="Cascading Style Sheets">CSS</acronym>&#8216;s widespread adoption are the many various and often extreme browser bugs and quirks present in the majority of browsers. When a <acronym title="Cascading Style Sheets">CSS</acronym> newbie begins writing some stylesheets, they are greeted with horrendous results thanks to these misbehaving browsers. I know of several Web design projects that have begun using stylehseets, only to abandon all but their most basic capability due to frustration on the designer&#8217;s part. Some <acronym title="Cascading Style Sheets">CSS</acronym> concepts are not easy to grasp for beginners, the box model being one of them, and I am not fond of the idea of presenting designers with yet more differences in the way their pages can be rendered.</p>
<p>Moreover, most <acronym title="Cascading Style Sheets">CSS</acronym> beginners I have encountered use a <acronym title="Graphical User Interface">GUI</acronym> such as Dreamweaver or GoLive to create their stylesheets. In this case, a question arises for the developers of these interfaces: how do I visually show which kind of box-sizing is being used for this particular box on the screen? Do I show a little icon in the corner of the box&#8217;s display? Do I hide it in a dialog box?</p>
<p>In my opinion, these interfaces are not very good for creating style sheets. There is currently no application whith which you can actually draw, with your mouse, a rectangle of padding onto an element. You have to type a number into the &ldquo;Padding&rdquo; input box and then select the unit you&#8217;d like to use from a drop down menu. Designers do not think this way. Coders and programmers do. But coders and programmers aren&#8217;t the ones who really need <acronym title="Cascading Style Sheets">CSS</acronym>. Designers do. And they need their tools and their web browsers to speak their own language to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/10/28/observations-on-the-css3-box-sizing-property-and-how-designers-use-style-sheets/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>View the Web Your Way with Edit CSS</title>
		<link>http://maymay.net/blog/2004/10/15/view-the-web-your-way-with-edit-css/</link>
		<comments>http://maymay.net/blog/2004/10/15/view-the-web-your-way-with-edit-css/#comments</comments>
		<pubDate>Fri, 15 Oct 2004 21:16:52 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">/?p=90</guid>
		<description><![CDATA[For a while I have been using the Web Developer Toolbar in Firefox for various puroses. It&#8217;s extremely helpful, allowing me to quickly and easily outline custom elements, display the rendered sizes of block-level elements, provide an overview of the page&#8217;s structure without fiddling with the DOM inspector (choose CSS &#8594; View Style Information&#8230; and [...]]]></description>
			<content:encoded><![CDATA[<p>For a while I have been using the <a href="http://extensionroom.mozdev.org/more-info/webdeveloper">Web Developer Toolbar</a> in <a href="http://www.mozilla.org/products/firefox/">Firefox</a> for various puroses. It&#8217;s extremely helpful, allowing me to quickly and easily outline custom elements, display the rendered sizes of block-level elements, provide an overview of the page&#8217;s structure without fiddling with the <acronym title="Document Object Model">DOM</acronym> inspector (choose <acronym title="Cascading Style Sheets">CSS</acronym> &rarr; View Style Information&hellip; and then look at the status bar as you move your mouse over the page), and much more.</p>
<p>However, I&#8217;ve also actually been using it to make my experience on the Web more my own.</p>
<h3>Introducing Edit <acronym title="Cascading Style Sheets">CSS</acronym></h3>
<p>One especially useful option in the Web Developer Toolbar for the Firefox and Mozilla Web browsers is the &ldquo;Edit <acronym title="Cascading Style Sheets">CSS</acronym>&rdquo; option. You can get at it from the Tools Menu &rarr; Web Developer &rarr; <acronym title="Cascading Style Sheets">CSS</acronym> &rarr; Edit <acronym title="Cascading Style Sheets">CSS</acronym> or by pressing <kbd>CTRL</kbd> + <kbd>SHIFT</kbd> + <kbd>E</kbd>. This will show the browser sidebar and, if any exist, load the existing styles applied to the page you&#8217;re viewing in a large text-entry field.</p>
<p>To use the feature, simply start typing in some applicable <acronym title="Cascading Style Sheets">CSS</acronym>. On each keypress, Firefox evauluates your style rules and applies any changes as appropriate. In other words, you can edit the styles of any page you visit faster and easier than ever before, and your changes are displayed live, as you type!</p>
<p>I like this a lot, because it further develops the application of the philosophy that giving the user more control over his or her environment is a good thing. Here are some examples of how to start making this new power work for you right away.</p>
<h3>Exercise Your Power</h3>
<ol>
<li>
<p>The next time you come across a web site whose entire textual content is centered on the page (we all know how annoying that is), open your Edit <acronym title="Cascading Style Sheets">CSS</acronym> sidebar and type the following:</p>
<pre>* { text-align: left; }</pre>
<p>This will immediately left-justify all text on the page. Now you can read with ease!</p>
</li>
<li>
<p>To further help readability on pages whose line lengths span the whole screen, add a suitable maximum width for your reading pleasure:</p>
<pre>* { max-width: 40em; }</pre>
<p>Now all elements on the page won&#8217;t be wider than 40 em&#8217;s which should be comfortable for most people. Of course, feel free to substitute your own value in place of mine. That&#8217;s the beauty of it.</p>
</li>
<li>
<p>If the author of the page you&#8217;re viewing has chosen a horrendously annoying shade of pink or yellow to display text in (often coupled with an equally unreadable choice of background color), just open your Edit <acronym title="Cascading Style Sheets">CSS</acronym> sidebar and type the following:</p>
<pre>* { color: black; background: white; }</pre>
<p>Now you have easy-to-read text and you don&#8217;t have to strain your eyes. Again, simply swap the values for white text on a black background to inverse the colors, or feel free to use your own preffered colors.</p>
</li>
</ol>
<h3>What if the page doesn&#8217;t change?</h3>
<p>If the page you&#8217;re viewing hasn&#8217;t changed after typing these lines in the Edit <acronym title="Cascading Style Sheets">CSS</acronym> sidebar, then you&#8217;ve either mistyped something or another rule later down in the style sheet is overriding the one you just added. In this case, you can either go hunting for the stubborn culprit in the original <acronym title="Cascading Style Sheets">CSS</acronym> or try increasing the weight of your own rule by doing one of the following:</p>
<ul>
<li>
<p>Increase your rule&#8217;s specificity by adding <code>html&gt;body</code> to the front of your selector (in my examples above, the asterisk (<code>*</code>) symbol is your selector). That is to say, your modified rule becomes:</p>
<pre>html&gt;body * { text-align: left; }</pre>
</li>
<li>
<p>Make your rule <code>!important</code> by adding that text after the rule. Your modified rule, marked as important, would look like this:</p>
<pre>* { text-align: center !important }</pre>
</li>
</ul>
<p>According to the creators of <acronym title="Cascading Style Sheets">CSS</acronym>, one of their goals was to make the Web more customizable to the end user. Thanks to tools like Firefox&#8217;s Edit <acronym title="Cascading Style Sheets">CSS</acronym> option in the wonderful Web Developer Toolbar, this is finally an easily-achieveable reality!</p>
<h3>Create Personal Stylesheet Preferences in Other Browsers</h3>
<p>If you&#8217;re not using a Mozilla-based browser (<a title="A stead-fast Internet Explorer user explains why he switched to Firefox" href="http://news.com.com/Why%20I%20dumped%20Internet%20Explorer/2010-1032_3-5391063.html">why aren&#8217;t you?</a>) and don&#8217;t have access to this extension, try writing your own style sheets with your specific display preferences in it and applying them through your browser software.</p>
<p>Your style sheet is just a plain text file which can be written in any text editor.</p>
<p>Safari on the Mac allows this by going to the Safari Menu &rarr; Preferences &rarr;  click the Advanced pane &rarr; select <strong>Other&hellip;</strong> from the Style Sheet drop down menu and select your style sheet.</p>
<p>Internet Explorer for Windows also supports this technique but the option is a little more cleverly hidden. Go to the Tools Menu &rarr; select Internet Options&hellip; &rarr; click on Accessibility &rarr; check &ldquo;Format documents using my style sheet&rdquo; in the &ldquo;User Style Sheet&rdquo; section &rarr; click Browse and open your style sheet.</p>
<p>(Internet Explorer 5 for the Mac also supports this option but that browser is so bad, so old, so slow, so buggy, and so insecure that finding the option is left as an exercise to any reader who dares to still use it.)</p>
<p>Opera for Windows and Mac also let you choose your own style sheet. Go to Preferences (from the Opera menu on a Mac or from the Tools menu on Windows) &rarr; click Page Style in the left column &rarr; click Choose next to the text box that reads &ldquo;My style sheet.&rdquo;</p>
<p>Here&#8217;s a recommendation for what to put in your new personal style sheet. Remember, however, it&#8217;s <em>your</em> style sheet, so feel free to start with this but add your own preferenes as well!</p>
<pre>
/* make pages dark-on-light and use a big-enough text size */
body { background: white; color: black; font-size: medium; }
/* keep paragraphs narrow and left-justified */
p { max-width: 40em; text-align: left !important }
/* I want headings in the Times font */
h1, h2, h3, h4, h5, h6 { font-weight: bold; font-family: Times; }
/* show me what the access keys are! */
[accesskey]:after { content: "(Access key: " attr(accesskey) ")" }
/* show me which images are actually links */
a img { border: 2px solid blue; }
</pre>
<p>Try browsing the Web with your new stylesheet. I&#8217;d be very interested to hear how it goes. Which sites could you use your new preferences in without any problem? Which did you break?</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/10/15/view-the-web-your-way-with-edit-css/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Make Marked-Up Lists Look Like Paragraph Text</title>
		<link>http://maymay.net/blog/2004/10/06/make-marked-up-lists-look-like-paragraph-text/</link>
		<comments>http://maymay.net/blog/2004/10/06/make-marked-up-lists-look-like-paragraph-text/#comments</comments>
		<pubDate>Wed, 06 Oct 2004 21:03:58 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">/?p=66</guid>
		<description><![CDATA[Here&#8217;s a useful little snippet of CSS2 lifted straight off a personal project I&#8217;ve been working on. The following four rules display, find, and insert appropriate punctuation for making unordered lists read like English prose. ul, ul li { display: inline; list-style: none; margin: 0; padding: 0; } li:after { content: ", "; } li:last-child:after [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a useful little snippet of <acronym title="Cascading Style Sheets level 2">CSS2</acronym> lifted straight off a personal project I&#8217;ve been working on. The following four rules display, find, and insert appropriate punctuation for making unordered lists read like English prose.</p>
<pre>ul, ul li {
    display: inline; list-style: none; margin: 0; padding: 0;
}
li:after { content: ", "; }
li:last-child:after { content: "."; }
li+li:last-child:before { content: "and "; }
</pre>
<p>Here&#8217;s what&#8217;s happening.</p>
<ol>
<li>First they display the entire list and each list item as an inline element. This causes them to show up right up against any other text around them.</li>
<li>Then they add a comma and a space after each list item.</li>
<li>The last list item, however, gets a period and no space.</li>
<li>Finally, the word &ldquo;and&rdquo; followed by a space is inserted before the last list item if, and only if, there is a list item before it (it has a sibling).</li>
</ol>
<p>There you have it. List markup that looks just like a normal paragraph, complete with proper punctuation! A great little tip that makes lists a whole lot more flexible!</p>
<p>Note that as of this writing this won&#8217;t work in Internet Explorer because it can&#8217;t understand the last three rules. Since it does understand the first, the result will merely be an inline box for the whole list, sans punctuation.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/10/06/make-marked-up-lists-look-like-paragraph-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping Presentation out of Behavioral JavaScripting</title>
		<link>http://maymay.net/blog/2004/09/22/keeping-presentation-out-of-behavioral-javascripting/</link>
		<comments>http://maymay.net/blog/2004/09/22/keeping-presentation-out-of-behavioral-javascripting/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">/?p=67</guid>
		<description><![CDATA[Lately I&#8217;ve been working on a personal project of mine, redesigning and revitilizing my website about Bipolar Disorder. It&#8217;s still deeply entrenched in the redesign and I&#8217;m not even done with the site templates yet, but I was anxious to get some content rolling out quickly so I went ahead with it anyway. Some elements [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been working on a personal project of mine, redesigning and revitilizing <a href="http://www.maymay.net/bpd/">my website about Bipolar Disorder</a>. It&#8217;s still deeply entrenched in the redesign and I&#8217;m not even done with the site templates yet, but I was anxious to get some content rolling out quickly so I went ahead with it anyway.</p>
<p>Some elements of the design, however, relied on dynamic scripting to style appropriately. The key thing here, however, is that I wanted to avoid accessing or manipulating style elements from within the JavaScript script. In other words, I wanted to ensure that all my style rules, the visual declarations for the presentation of these links, would be kept in the site&#8217;s <acronym title="Cascading Style Sheets">CSS</acronym>.</p>
<p>There were several reasons for this:</p>
<ol>
<li>To keep presentation clearly separated from behavior and structure.</li>
<li>To keep the JavaScript unobtrusive and portable.</li>
<li>To ensure that both aspects, presentation <em>and</em> behavior could be easily updated or altered in the future.</li>
<li>To allow for various styling without touching the script.</li>
</ol>
<p>Typically, a JavaScript script with a line similar to <code>elem.style.property = 'value';</code> is used to create so-called &ldquo;dynamic styles.&rdquo; Unfortunately, this would not do for me.</p>
<p>So I fiddled and found that the best way to go about this was to simply tag links that I wanted to style by adding a word to their <code>class</code> name and then write styles for the selected elements inside my stylesheets. In effect, links in my page will be transformed from <code>&lt;a href=&quot;http://some.other.site/&quot;&gt;&lt;/a&gt;</code> to <code>&lt;a <strong>class=&quot;external&quot;</strong> href="http://some.other.site/"&gt;&lt;/a&gt;</code> So I sat down and wrote this little plug-and-play JavaScript to tag the links I wanted. Let&#8217;s go over it line-by-line. (If you&#8217;re antsy, here&#8217;s <a href="#fullExtlinksScript">the whole script</a>.)</p>
<p>First, we define a function named <code>catchExternalLinks</code>. Then we set a variable, <var>extClassName</var>, to hold the class name we&#8217;re going to add to the links. While not strictly necessary to hold in a variable, it does make for easy editing later. Don&#8217;t like the word &ldquo;external&rdquo; for a class name? Change it to something else.</p>
<pre>function catchExternalLinks()
{
    var extClassName = 'external';</pre>
<p>Next, we do some <a href="http://www.quirksmode.org/js/support.html">object detection</a>. This is to ensure that the browser can handle what we&#8217;re going to ask of it. Browsers that can&#8217;t handle it won&#8217;t try to, which is good because it means visitors won&#8217;t see an error when they visit the site. They just won&#8217;t see the dynamic styling.</p>
<pre>if (document.links &amp;&amp; document.getElementById) {</pre>
<p>Now that we know we&#8217;re talking only to browsers which can handle our instructions, we define a variable, <var>h</var> (for <strong>h</strong>ost), which will store the beginning of the web address that we&#8217;re at. On www.maymay.net, <var>h</var> now contains the string <code>http://www.maymay.net</code>.</p>
<pre>var h = window.location.protocol + '//' + window.location.host;</pre>
<p>Next, we need to gather all the links in our page. We assign the links array to the variable <var>l</var>.</p>
<pre>var l = document.links;</pre>
<p>We need to work with each link separately, so we loop through the links&hellip;</p>
<pre>for (var i = 0; i &lt; l.length; i++) {</pre>
<p>&hellip;and assign the value of the <code>href</code> property to the <var>target</var> variable after turning the string <code>toLowerCase</code> text.</p>
<pre>var target = l[i].href.toLowerCase();</pre>
<p>We only want to work with real links, so first we make sure we&#8217;re not dealing with <code>javascript:</code> directives.</p>
<pre>if (target.substr(0, 11) != 'javascript:') {</pre>
<p>Then we search the <var>target</var> string of the link for the <var>h</var> string. If we don&#8217;t find it&hellip;</p>
<pre>if (target.substr(0, h.length).indexOf(h) == -1) {</pre>
<p>&hellip;then this link is an external link so we tag it as such by adding the <var>extClassName</var> to its <code>className</code> preceded by a space. We do this instead of using <code>setAttribute()</code> because this way we can keep any pre-existing values for the <code>class</code> attribute already in the link. The key here is to know that <code>className</code> accesses the <code>class</code> attribute of an element.</p>
<pre>    l[i].className += ' ' + extClassName;}</pre>
<p>Finally, after closing all our blocks properly, we set the <code>catchExternalLinks</code> function to execute <code>onload</code>.</p>
<pre>            }
        }
    }
}
window.onload = catchExternalLinks;</pre>
<p>Of course, as per the requirements for this script being as unobtrusive as possible, it won&#8217;t do anything to the style properties of the link. All it did was add a <code>class</code> value, so we&#8217;ll need to declare our styles in our stylesheet. In my <acronym title="Cascading Style Sheets">CSS</acronym> page, I write the following to display a little icon for these links.</p>
<pre>a.external {
    padding-right: 15px;
    background: transparent url(extlink.gif) center right no-repeat;
}</pre>
<p>The styling possibilities are really rather endless now. Since I can instantly identify external links via the class <code>external</code>, I can also write context-specific styles. For instance, I can limit my styles to only one part of the page with a selector such as</p>
<pre>#main a.external { ... }</pre>
<p>or I could write different styles for external links for the sidebar and a comment  on my entry with</p>
<pre>#sidebar a.external { ... }
.blogComment a.external { ... }</pre>
<p>or any other styling I see fit. In addition, from the script, it&#8217;s very easy to test for links that meet a specific criteria, say, Google definition searches, simply by adding another <code>if</code> clause inside the main loop. Here&#8217;s a version that does just that.</p>
<p><a name="fullExtlinksScript"></a>All together, it goes like this:</p>
<pre>function catchExternalLinks()
{
    var extClassName = 'external';  // the class to set for external links
    var defClassName = 'defSearch'; // the class to set for definition searches
    if (document.links &amp;&amp; document.getElementById)
    {
        var h = window.location.protocol + '//' + window.location.host;
        var l = document.links;
        for (var i = 0; i &lt; l.length; i++)
        {
            var target = l[i].href.toLowerCase();
            if (target.substr(0, 11) != 'javascript:') // only work on links that aren't JavaScript directives
            {
                // tag external links
                if (target.substr(0, h.length).indexOf(h) == -1)
                {
                    l[i].className += ' ' + extClassName;
                }
                // tag Google definition search links
                var anchor = l[i].childNodes[0].nodeValue; // anchor now contains the anchor text of the link
                var s = '?q=define:' + anchor;
                if (target.substr(0, target.length).indexOf(s) != -1) // use != to ensure that the string (var s) EXISTS in target
                {
                    l[i].className += ' ' + defClassName;
                    l[i].title = 'Definitions for ' + anchor + ' on the Web.'; // for the link tooltip
                }
            }
        }
    }
}
window.onload = catchExternalLinks;</pre>
<p>Feel free to steal this snippet. Just remember to write your styles in a stylesheet that you connect to your page, or the script won&#8217;t have any noticeable effect. Of course, that&#8217;s the whole point. Enjoy! ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2004/09/22/keeping-presentation-out-of-behavioral-javascripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

