<?xml version="1.0" encoding="ISO-8859-1"?>
<rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel>
<title>NealGrosskopf.com - Geek Speak</title>
<link>http://www.nealgrosskopf.com/tech/</link>
<description>a NG Designs Website...</description>
<language>en-us</language>
<copyright>Copyright .#169; 2008 NealGrosskopf.com</copyright>
<lastBuildDate>Thu, 12 Nov 2009 06:53:00 -0600</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>NealGrosskopf.com RSS Generator</generator>
<managingEditor>Neal Grosskopf</managingEditor>
<webMaster>Neal Grosskopf</webMaster>
<image>
<title>NealGrosskopf.com</title>
<url>http://www.nealgrosskopf.com/files/ico/favicon.ico</url>
<link>http://www.nealgrosskopf.com</link>
</image>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
<title>Fix The Internet: Write You Own Custom Website CSS Rules With Stylish</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/JQGNviO_8HY/thread.php</link>
<description>&lt;p&gt;For those familiar with Greasemonkey, a Firefox addon for writing custom Javascript on websites, &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2108"&gt;Stylish&lt;/a&gt; alows you to write custom CSS for websites. Stylish makes it extremely easy to fix annoying 
websites (such as MySpace), hide advertisements and diagnose web design issues.&lt;/p&gt;

&lt;h4&gt;Fix The &lt;a href="http://www.youtube.com/watch?v=LKTH6f1JfX8"&gt;Internet(s)&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;One of best uses of Stylish is to override website's poor design choices. MySpace, a website that gives uneducated users control of the design is a great example of this. I spent roughly 2 minutes on the site 
&lt;a href="http://www.myspace.com/ktroclady"&gt;looking for an&lt;/a&gt; &lt;a href="http://www.myspace.com/abbylane_1"&gt;example&lt;/a&gt; and had no trouble finding a couple.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/ugly-myspace-examples.jpg"  class="frame" alt="Examples of poor design choices on Myspace"&gt;&lt;/p&gt;

&lt;h4&gt;Creating Custom CSS Rules&lt;/h4&gt;

&lt;p&gt;Stylish makes it really easy to fix a broken design. With a little CSS know-how you can fix MySpace and other offending sites by first clicking on the Stylish icon, then going to "write new style" and finally choosing whether you want to create a new rule 
for a single URL, domain or your own rule. I almost always pick domain to make the changes site-wide.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/example1.png"  class="frame" alt="Stylish menu example"&gt;&lt;/p&gt;

&lt;p&gt;After making your choice, you're presented with an input box. For those familiar with CSS, simply add in whatever CSS you want, give it a name and click "save". Within the two curly brackets you can insert any CSS rules you want.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/creating-rule.png" class="frame" alt="Creating rules with Stylish"&gt;&lt;/p&gt;

&lt;h4&gt;Pro Tips&lt;/h4&gt;

&lt;p&gt;This is a great chance to brush up on your &lt;b&gt;&lt;a href="http://www.nealgrosskopf.com"&gt;CSS Selector Specificity&lt;/a&gt;&lt;/b&gt; skills since you'll need to give your selectors more weight than the current ones on the website. The easiest way to achieve this is to 
use the &lt;samp&gt;!important&lt;/samp&gt; keyword like so:&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("myspace.com") {
html, body { background-image: none !important; }
}
&lt;/code&gt;

&lt;p&gt;Another great tool to add to your arsenal is &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt;. With Firebug you can determine how to circumvent horrible designs by sifting through the design's stylesheet. Once you've 
determined what selector's properties are creating the ugliness it's easy to copy and paste that into to Stylish and add &lt;samp&gt;!important&lt;/samp&gt; to the end.&lt;/p&gt;

&lt;h4&gt;Other Uses?&lt;/h4&gt;

&lt;p&gt;Another great use for Stylish is to re-enable functionality on websites. I've noticed some websites using pop-up DIVs to force users into registering. With Stylish, you can hide these annoyances and continue using the site without giving away your 
information:&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/imeem.jpg" class="frame" alt="imeem's annoying registration box"&gt;&lt;/p&gt;

&lt;p&gt;In the screenshot above, the website imeem.com forces uses to register in order to listen to music for free. The CSS below hides the annoying DIV:&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("www.imeem.com") {
.mask, .bd { display: none !important; }
}
&lt;/code&gt;


&lt;h4&gt;HTML &amp;amp; CSS Diagnostics&lt;/h4&gt;

&lt;p&gt;Another excellent use of Stylish is &lt;b&gt;&lt;a href="/tech/thread.php?pid=17"&gt;CSS Diagnostics&lt;/a&gt;&lt;/b&gt;. If you're not familiar with CSS Diagnostics, they're basically CSS Selectors that highlight ugly parts of your HTML such as &lt;samp&gt;FONT&lt;/samp&gt; 

element or the use of &lt;samp&gt;TABLE&lt;/samp&gt; attributes 
such as &lt;samp&gt;BORDER&lt;/samp&gt;, &lt;samp&gt;CELLSPACING&lt;/samp&gt; etc.&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("example.com") {
font, table[cellspacing], table[border] { border: 1px solid red !important; }
}
&lt;/code&gt;

&lt;h4&gt;Hide Advertisements&lt;/h4&gt;

&lt;p&gt;Another great use of Stylish is to hide ads on webpages. While I realize that the Firefox addon &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1865"&gt;Adblock Plus&lt;/a&gt; already does this, occasionally it will 
miss an ad on website.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/60/noads.jpg" class="frame" alt="Hide advertisements on web pages"&gt;&lt;/p&gt;

&lt;p&gt;Notice how I hid the default Google search results ads above with a single selector below:&lt;/p&gt;

&lt;code&gt;
@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("www.google.com") {
#mbEnd { display: none !important; }
}
&lt;/code&gt;

&lt;h4&gt;Conclusion&lt;/h4&gt;

&lt;p&gt;Stylish is a great tool for web designers and developers. Below are links to addons I mentioned in this article to get you started:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2108"&gt;Stylish&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1865"&gt;Adblock Plus&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=60"&gt;View Comments [5]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/JQGNviO_8HY" height="1" width="1"/&gt;</description>
<pubDate>Thu, 08 Oct 2009 22:17:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=60</guid>
<author>Neal Grosskopf</author>
<category>firefox</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=60</feedburner:origLink></item>
<item>
<title>Everything You Need To Know About CSS Selector Specificity</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Zzh2GZjaxB0/thread.php</link>
<description>&lt;p&gt;There's an obscure topic of CSS that I think many people aren't aware of. It's called 'specificity'. I suppose it's not as glamorous as rounded corners, drop shadows or animations but it's still just 
as important in your day to day work as any other part of CSS.&lt;/p&gt;

&lt;p&gt;So what is CSS specificity? It's a weighted value system for &lt;b&gt;all&lt;/b&gt; of your selectors. Essentially, each piece of your selector has a value applied to it. This can be explained easiest in 
three separate groups: IDs, classes &amp;amp; elements. Perhaps one way to look at it is like a card games where face cards have a greater value than say, a 2,3, or 4.&lt;/p&gt;

&lt;img src="/tech/resources/59/article-image.png" class="frame" alt="CSS Specificity"&gt;

&lt;h3&gt;IDs&lt;/h3&gt;

&lt;p&gt;IDs are the most powerful type of selector you can use. Each ID in your selector will contribute 100 points to the selector's total value. Another thing to remember is IDs should be unique so there's really no 
reason you should be using more than one ID in your selector, unless you're trying to give your selector a higher point value than another one.&lt;/p&gt;

&lt;p&gt;The first example below has a point value of 100, while the second example has a point value of 300.&lt;/p&gt;

&lt;code&gt;
#content { }
#content #aside #caption { }
&lt;/code&gt;

&lt;h3&gt;Classes&lt;/h3&gt;

&lt;p&gt;Your second most important type is the class selector. Unlike IDs classes can, and should be used multiple times in a single HTML document. Classes occupy the 10's place in our point value system. 
This means that every instance of a class in your selector is worth 10 points. This means that a single ID will trump a 9 class selector.&lt;/p&gt;

&lt;p&gt;The two selectors below are of equal value. Notice how many classes were used compared to just a single ID, both which have a 100 point value.&lt;/p&gt;

&lt;code&gt;
#caption { }
.content-highlight .aside-type .float .bold .uppercase .quote .featured .etc .etc .etc { }
&lt;/code&gt;

&lt;h3&gt;Elements&lt;/h3&gt;

&lt;p&gt;Last but least are elements. An element selector is more generic than IDs and classes. They have the widest range of focus of all selectors. Because of this, element selectors occupy the ones position. Element 
selectors have a value of 1 point each.&lt;/p&gt;

&lt;p&gt;Again, both selectors below have the same point value. Notice how many elements were needed to equal a single class. Selectors inside the negation pseudo-class, :not(), are counted like any other, but the negation itself does not count as a pseudo-class.&lt;/p&gt;

&lt;code&gt;
.uppercase { }
html body div div blockquote span span span b i { }
&lt;/code&gt;

&lt;h3&gt;Odds &amp;amp; Ends&lt;/h3&gt;

&lt;p&gt;As we all know the 3 groups of selectors above does not encompass everything. Attributes selectors, and pseudo-classes both have the same value as classes which is 10 points each. The universal selector "*" has no point value.&lt;/p&gt;

&lt;h3&gt;Real World Usage&lt;/h3&gt;

&lt;p&gt;Okay, so far I've shown you some absolutely terrible examples of this in use. Almost none of the selectors above should be seen in a production environment. Lets take a look at some real world examples. How the system works 
is each type is tallied up, and then concatenated together. So 1 ID + 1 Classes + 1 Element would equal 111 points. See below for some more examples from my own stylesheet.&lt;/p&gt;

&lt;style type="text/css"&gt;
#content table tr td:first-child { text-align: left; }
&lt;/style&gt;

&lt;table class="data right"&gt;
&lt;caption&gt;CSS Selector Specificity Examples&lt;/caption&gt;
&lt;tr&gt;
	&lt;th&gt;Selector&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;IDs&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;Classes&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;Elements&lt;/th&gt;
	&lt;th style="width: 75px;"&gt;Weight&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#header h2&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;101&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content a[href$=".css"]&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;111&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content input[type="text"]:focus &lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;121&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;.code li:before &lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#helper ul li a&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;3&lt;/td&gt;
	&lt;td&gt;103&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;.actions li:hover b &lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content .comment:target &lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;120&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;#content img.loading &lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;111&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;table tr:nth-child(odd)&lt;/td&gt;
	&lt;td&gt;0&lt;/td&gt;
	&lt;td&gt;1&lt;/td&gt;
	&lt;td&gt;2&lt;/td&gt;
	&lt;td&gt;12&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;Why Is This !important&lt;/h3&gt;

&lt;p&gt;So now we know how to give our selectors a point value, so what? Why does this even matter? Specificity is extremely valuable if you're working on a website with multiple stylesheets. Perhaps it's a content management system that has a default stylesheet 
and your job is to overwrite its default values. The old MySpace layout is a great example where people would use specificity to modify their pages to their liking. Perhaps you're a beginner adding some new CSS to a 1000 line CSS file only to find your changes 
didn't change anything.&lt;/p&gt;

&lt;p&gt;Finally I couldn't talk about specificity without mentioning "!important". !important can be applied to individual properties to give them a super-value, thus trumping any prior property references.&lt;/p&gt;

&lt;code&gt;
#content { color: black; }
html .content { color: #333 !important; }
&lt;/code&gt;

&lt;h3&gt;Resources&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.w3.org/TR/css3-selectors/#specificity"&gt;CSS Specification: Calculating a selector's specificity&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=59"&gt;View Comments [6]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Zzh2GZjaxB0" height="1" width="1"/&gt;</description>
<pubDate>Thu, 17 Sep 2009 20:54:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=59</guid>
<author>Neal Grosskopf</author>
<category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=59</feedburner:origLink></item>
<item>
<title>Identify The Age Of Your Word &amp; PDF Files Using CSS &amp; jQuery</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/6nkH-zG3THM/thread.php</link>
<description>&lt;div class="image-caption" style="width: 260px; float: right; margin: 0px 0px 20px 20px;"&gt;	
	&lt;img src="/tech/resources/58/word-acrobat-boxshots.jpg" alt="Microsoft Word &amp;amp; Adobe Acrobat"&gt;	
	&lt;h3&gt;Word &amp;amp; Acrobat&lt;/h3&gt;	
	&lt;p&gt;Learn how to display a "new" icon next to your Word and PDF files.&amp;nbsp;&amp;nbsp;&lt;a href="/tech/resources/58/"&gt;Skip To Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;A request that often pops up at my workplace is the ability to tag files as "new" when we add them to our websites. The sites that I develop are usually littered with PDFs and Word documents so 
this can be a daunting task to manage whether a file is "new" or not since there are hundreds of files on the site.&lt;/p&gt;

&lt;p&gt;Ultimately what happened, is our .NET programmer added a field to the database for date which we enter in the last updated date and he does the logic server-side. That worked great for PDF and DOC files in the 
database but in reality, that only cover 50% of the files on our site.&lt;/p&gt;

&lt;h3&gt;CSS Only Solution?&lt;/h3&gt;

&lt;p&gt;My original idea was to solve this problem using only CSS. After all, CSS is my specialty. I was thinking around the lines of adding some metadata to my anchors like so:&lt;/p&gt;

&lt;code&gt;
&amp;lt;a href="august_2009_updates.pdf rel="2009-08-01"&amp;gt;August Updates&amp;lt;/a&amp;gt;
&lt;/code&gt;

&lt;p&gt;As you can see the above example is clearly time-sensitive. Normally what would happen is a month or two later, this file would be sitting on our site with the "new" icon still intact. My CSS only 
solution was to do something like this:&lt;/p&gt;

&lt;code&gt;
a[href^="2009-08"] { background: url(new.png) no-repeat left center; }
&lt;/code&gt;

&lt;p&gt;The problem with this is I don't have the ability to use variables or date-based logic in CSS so once it passes August, I'll need to update my CSS selector. &lt;i&gt;PS I'm aware that I could use some sort of server-side 
solution serving CSS up via ASP or PHP and then use variables. I hate mixing server-side code with static files like CSS or Javascript so I avoided this.&lt;/i&gt;&lt;/p&gt;

&lt;h3&gt;Enter jQuery and CSS&lt;/h3&gt;

&lt;p&gt;Next, I created a jQuery plugin that tags files by date with a new icon. It can be called with a selector that will narrow the focus of the search. Some parameters to this plugin 
are what attribute to search (I used the &lt;samp&gt;rel&lt;/samp&gt; attribute. The next parameter is the name of the class name that will be assigned. After that it takes a parameter for the number of days that have passed 
to determine if the link is "new" or not. Finally the last parameter is for debugging purposes.&lt;/p&gt;

&lt;code&gt;
$(document).ready(function(){
	$("#content a").newClass("rel","new",90,true);
});
&lt;/code&gt;

&lt;h3&gt;JQuery Plugin&lt;/h3&gt;

&lt;p&gt;Below is the corresponding jQuery plugin I wrote:&lt;/p&gt;

&lt;code&gt;
(function($){
	$.fn.newClass = function(attr,classname,offset,debug){
		var now = new Date();
		var day = 1000*60*60*24;
				
		return this.each(function(i){		
			var old = new Date($(this).attr(attr));	
			var diff = Math.floor((now.getTime() - old.getTime()) / day);			
			if(diff &lt; offset) $(this).addClass(classname);			
			if(debug) $(this).append(" - " + diff + " day(s)"); //testing
		});
	}
})(jQuery);
&lt;/code&gt;

&lt;p&gt;To see this in action &lt;b&gt;&lt;a href="/tech/resources/58/"&gt;view the demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=58"&gt;View Comments [0]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/6nkH-zG3THM" height="1" width="1"/&gt;</description>
<pubDate>Tue, 08 Sep 2009 21:49:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=58</guid>
<author>Neal Grosskopf</author>
<category>jquery</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=58</feedburner:origLink></item>
<item>
<title>Easy Way To Get Your Twitter Followers Count/Custom Twitter Badge Using PHP</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Ts84u3dDqps/thread.php</link>
<description>&lt;div class="image-caption" style="width: 240px; float: right; margin: 0px 0px 20px 20px;"&gt;	
	&lt;img src="/tech/resources/57/twitter-count.png" alt="Example Twitter Follower Counter"&gt;	
	&lt;h3&gt;Custom Twitter Badge&lt;/h3&gt;	
	&lt;p&gt;An example of what can be accomplished by creating your own Twitter Badge.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;So you're on Twitter now? Like back in high school, we all want to be popular on Twitter as well. Prove it by displaying your followers count with this simple PHP script.&lt;/p&gt;

&lt;p&gt;One thing that annoys me with &lt;i&gt;all&lt;/i&gt; third party web services is they feel the need to brand their widgets. I don't blame them for doing this but it deters me from ever using them. 
What usually results from this is I tinker around and figure out a way to get the data I need without all their ugly branding.&lt;/p&gt;

&lt;h3&gt;The Setup&lt;/h3&gt;

&lt;p&gt;First we'll need to use PHP's built-in &lt;samp&gt;curl&lt;/samp&gt; function. This will grab the output of other web pages, files, etc. &lt;i&gt;Note I lifted the script below from another website so feel free to 
correct me on it.&lt;/i&gt;&lt;/p&gt;

&lt;code&gt;
function curl($url)
{
	$ch = curl_init($url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch,CURLOPT_HEADER, 0);	
	curl_setopt($ch,CURLOPT_USERAGENT,"www.YOURDOMAIN.com");
	curl_setopt($ch,CURLOPT_TIMEOUT,10);	
	$data = curl_exec($ch);
	curl_close($ch);
	return $data;
}
&lt;/code&gt;

&lt;h3&gt;Custom Twitter Badge Function&lt;/h3&gt;

&lt;p&gt;Next, we create the function that parses the &lt;samp&gt;curl&lt;/samp&gt; output. This uses the Twitter API. Simply call the function with your own Twitter username and it will return the number of followers you have:&lt;/p&gt;

&lt;code&gt;
function GetTwitterFollowerCount($username)
{
	$twitter_followers = curl("http://twitter.com/statuses/user_timeline/".$username.".xml?count=1");
	$xml = new SimpleXmlElement($twitter_followers, LIBXML_NOCDATA);
	return $xml-&gt;status-&gt;user-&gt;followers_count;
}

echo GetTwitterFollowerCount("YourTwitterName");
&lt;/code&gt;

&lt;h3&gt;Notes&lt;/h3&gt;

&lt;p&gt;Please take into consideration that you can only ping Twitter 150 times per hour. Because of this, it would be wise to create a text file and use it to cache your followers count. Also the function will 
only return a plain ol' number. Its up to your to think of a creative way to display this to your site's visitors. The more attractive you make it, the more likely your users will click it.&lt;/p&gt;

&lt;h3&gt;Related Posts:&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="/tech/thread.php?pid=36"&gt;How To Get Total Feedburner Subscribers With JQuery and ASP&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.php?pid=35"&gt;How To Get Total Diggs Using JQuery And ASP&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.php?pid=34"&gt;How To Get Delicious Bookmark Total Using JQuery And JSON&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=57"&gt;View Comments [9]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Ts84u3dDqps" height="1" width="1"/&gt;</description>
<pubDate>Mon, 24 Aug 2009 21:09:00 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=57</guid>
<author>Neal Grosskopf</author>
<category>php</category><category>twitter</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=57</feedburner:origLink></item>
<item>
<title>Converting A Site From Classic ASP To PHP: Some Things To Consider</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/cvYU4-K2MGk/thread.php</link>
<description>&lt;p&gt;Well, after a month of spending my evenings coding till the wee hours of the night, I've finished converting my website NealGrosskopf.com from Classic ASP to PHP. After going through this grueling ordeal I thought 
I'd write up a quick article detailing my experience and perhaps save a fellow web developer some time should they ever endeavor this process.&lt;/p&gt;

&lt;img src="/tech/resources/56/asp-to-php.png" alt="ASP to PHP"&gt;

&lt;h3&gt;Learn The Basics&lt;/h3&gt;

&lt;p&gt;If you're not familiar with PHP like I was, I'd suggest you learn the basic syntax differences between ASP and PHP. I pretty much self taught myself PHP using the tutorial website 
&lt;a href="http://www.tizag.com/phpT/"&gt;Tizag&lt;/a&gt;. I feel like I'm a pretty competent ASP coder so learning the basics of PHP wasn't too hard for me. Here's a few observations I found.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;	
&lt;h4&gt;Built In Functions&lt;/h4&gt;
&lt;p&gt;PHP seems to like ordering parameters in built in functions slightly different than ASP. For instance in ASP you have:&lt;/p&gt;

&lt;code&gt;
replace("Input String","Find","Replace With")
&lt;/code&gt;

&lt;p&gt;In PHP the order is slightly different as well as having a slightly different function name:&lt;/p&gt;

&lt;code&gt;
str_replace("Find","Replace With","Input String")
&lt;/code&gt;

&lt;p&gt;Some other examples of this in PHP are &lt;samp&gt;str_len&lt;/samp&gt; (&lt;samp&gt;len&lt;/samp&gt; in ASP), &lt;samp&gt;strpos&lt;/samp&gt; (&lt;samp&gt;instr&lt;/samp&gt; in ASP) and &lt;samp&gt;explode&lt;/samp&gt; (&lt;samp&gt;split&lt;/samp&gt; in ASP)&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Parse Errors&lt;/h4&gt;

&lt;p&gt;Forgetting to add a semi-colon ';' at the end of your PHP line = 'white screen of death'&lt;/p&gt;

&lt;p&gt;At least with my host's configuration (or possibly my own stupidity) parsing errors such as forgetting the semi-colon results in a very &lt;i&gt;not&lt;/i&gt;-useful white, blank, empty PHP error page. This 
can make troubleshooting the error very, very hard.&lt;/p&gt;	

&lt;p&gt;Fortunately I found a solution to this. &lt;a href="http://portableapps.com/apps/development/xampp"&gt;Portable XAMPP&lt;/a&gt;. 
I essentially ran web server locally which allowed me to test out my PHP pages (minus the My_SQL database). For whatever reason, my local copy did not give me the white screen of death and let me see the exact error message. 
This helped me find the error 10x faster. &lt;b&gt;I suggest if you're starting out with PHP, download Portable XAMMP and tinker with it locally, for free!&lt;/b&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Code Order&lt;/h4&gt;

&lt;p&gt;One problem that I ran into was the placement of my functions within my code. In ASP I could include files at the end of my page, and even have functions within these includes be called even before the code 
has reached that area of the script. I suspect ASP pre-compiles the functions ahead of time while PHP does not. My solution to this was to re-organize my code so that all the functions appeared first 
within my include structure.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Variable Scope, and isset()&lt;/h4&gt;	

&lt;p&gt;&lt;b&gt;Scope&lt;/b&gt; Another problem I ran into was variable scope. In Classic ASP I'd often something &lt;i&gt;like&lt;/i&gt; this:&lt;/p&gt;

&lt;code&gt;
FirstName = "Neal"	
...	
somefunction("Grosskopf")	
function somefunction(LastName)
	response.write FirstName &amp;amp; " " &amp;amp; LastName
end function
&lt;/code&gt;

&lt;p&gt;In PHP this will not work unless you use the &lt;samp&gt;$GLOBALS[]&lt;/samp&gt; array to your variable in the function like so:&lt;/p&gt;

&lt;code&gt;
$FirstName = "Neal";
...	
somefunction("Grosskopf");
function somefunction($LastName)
{
	$GLOBALS["FirstName"];
	echo $FirstName . " " . $LastName;
}
&lt;/code&gt;

&lt;p&gt;I'd also change global variables inside functions in Classic ASP. To fix this in PHP simply add the &lt;samp&gt;global&lt;/samp&gt; keyword to the variable:&lt;/p&gt;

&lt;code&gt;
function somefunction()
{
	global $FirstName";
	$FirstName = "Some Other Name";
}
&lt;/code&gt;

&lt;p&gt;&lt;i&gt;I'm sure these aren't good programming practices, but hey it works!&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;isset()&lt;/b&gt; In ASP you could do the following even if the variable has yet to be set:&lt;/p&gt;

&lt;code&gt;
if variable &amp;lt;&amp;gt; "" then
'do something
end if
&lt;/code&gt;

&lt;p&gt;In PHP this is not acceptable. Instead you'll need to use a built in function called isset(). This basically checks to see if the variable has been set yet:&lt;/p&gt;

&lt;code&gt;
if(isset($variable))
{
//do something
}
&lt;/code&gt;

&lt;p&gt;This isn't a huge difference, but since I was using the ASP method quite a bit, I needed to re-learn the new way to accomplish this in PHP.&lt;/p&gt;

&lt;/li&gt;

&lt;li&gt;
&lt;h4&gt;Redirects&lt;/h4&gt;

&lt;p&gt;Another common problem you'll run into when converting from ASP to PHP is redirects. In Classic ASP you could do a redirect using the following:&lt;/p&gt;	

&lt;code&gt;
response.redirect("thank-you-page.asp")
&lt;/code&gt;

&lt;p&gt;In PHP if you need to use the &lt;samp&gt;header&lt;/samp&gt; function&lt;/p&gt;

&lt;code&gt;
header("Location: thank-you-page.php");
&lt;/code&gt;

&lt;p&gt;Another thing to consider is if you place your &lt;samp&gt;header&lt;/samp&gt; function further down your page, possibly after you've already output content to your page. If this happens then you'll need to 
use the output buffer, at the top of your page:&lt;/p&gt;

&lt;code&gt;
ob_start();
&lt;/code&gt;

I'd also recommend saving your session data before you do a redirect in PHP like so:

&lt;code&gt;
session_write_close();
&lt;/code&gt;

&lt;h5&gt;Here's all the code at once:&lt;/h5&gt;

&lt;code&gt;
ob_start();

//Some other code here

session_write_close();
header("Location: thank-you-page.php");
&lt;/code&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Redirect Those Old ASP Pages To PHP&lt;/h3&gt;

&lt;p&gt;The great thing about switching to PHP is you now have the ability to use the much hailed .htaccess file. My very limited perception of this file is it acts as a gatekeeper between every file on your website 
and the end-user requesting the files. It allows you to intercept any request made to the server. One sweet rule I found for .htaccess is the ability to redirect my old ASP pages to their PHP equivalent:&lt;/p&gt;

&lt;code&gt;
RedirectMatch 301 /(.+)asp$ /$1php
&lt;/code&gt;

&lt;p&gt;Its sad but that one line takes care of it all for me. Google will now crawl my new PHP pages, and users with bookmarks to the old pages will still find them. It's almost too easy!&lt;/p&gt;


&lt;h3&gt;Final Thoughts&lt;/h3&gt;

&lt;p&gt;Those are just a &lt;i&gt;few&lt;/i&gt; of the differences I've experienced between PHP and ASP. I'm sure there's thousands more. Overall I'm very happy with my new PHP website and I'm happy I've finally taken the 
time to switch.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Anyone else convert an ASP site to PHP before? How was your experience?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=56"&gt;View Comments [9]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/cvYU4-K2MGk" height="1" width="1"/&gt;</description>
<pubDate>Wed, 19 Aug 2009 12:37:37 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=56</guid>
<author>Neal Grosskopf</author>
<category>asp</category><category>php</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=56</feedburner:origLink></item>
<item>
<title>A New Method To Target Internet Explorer In Javascript</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/McZKfNxaktQ/thread.php</link>
<description>&lt;p&gt;&lt;i&gt;Preface: It's quite possible that I'm not the first to discover this. But I did come up with this idea without finding a prior example of it before.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;I was working with JQuery at work last week and Internet Explorer was giving me some trouble, mainly due to it's sucky Javascript performance and some of it's flaky text+opacity issues. 
My solution to this was to remove animations from IE and change the element's CSS properties without an animation. I was now tasked with finding a way within Javascript to target IE.&lt;/p&gt;

&lt;img src="/tech/resources/55/demo.png" class="frame" alt="A New Method To Target Internet Explorer In Javascript"&gt;

&lt;p&gt;&lt;i&gt;An aside, I'm fully aware that IE's JScript engine contains a method at targeting IE using &lt;a href="http://msdn.microsoft.com/en-us/library/ahx1z4fs%28VS.80%29.aspx"&gt;JScripts conditional comments&lt;/a&gt;, but I've never been too impressed with these 
because they only allow me to target JScript versions, and not individual IE builds.&lt;/i&gt;&lt;/p&gt;

&lt;h3&gt;Enter: CSS Conditional Comments&lt;/h3&gt;

&lt;p&gt;Being a seasoned CSS veteran of the web standards wars (ok kidding) I turned to what I know best...&lt;a href="http://msdn.microsoft.com/en-us/library/ms537512%28VS.85%29.aspx"&gt;CSS Conditional Comments&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've seen most people use Conditional Comments (CC) to target IE in CSS hacks, but I seldom see people serve IE anything other than stylesheets with this method. I think a few people forget that you can actually wrap CCs
around any valid HTML elements (see &lt;a href="http://www.positioniseverything.net/articles/cc-plus.html"&gt;PositionIsEverything&lt;/a&gt; for a sweet method of doing this).&lt;/p&gt;

&lt;p&gt;CCs are pretty simple to use. They're pretty much HTML comment blocks that only IE recognizes. The example below will only show up to IE6 users.&lt;/p&gt;

&lt;code&gt;
&amp;lt;!--[if IE 6]&amp;gt;
Hello IE6!
&amp;lt;![endif]--&amp;gt;
&lt;/code&gt;

&lt;p&gt;We can also target previous browser releases with the following:&lt;/p&gt;

&lt;code&gt;
&amp;lt;!--[if lte IE 6]&amp;gt;
Hello IE6!
&amp;lt;![endif]--&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Enough Already! What About Javascript!&lt;/h3&gt;

&lt;p&gt;Using these same principles, we can wrap conditional comment blocks around our Javascript blocks. Then flag variables within these blocks to identify the browser as IE6, IE7 or plan ol' IE.&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
//By default, flag browser as not IE to non IE browsers
var ie6 = false;
var ie = false;
&amp;lt;/script&amp;gt;

&amp;lt;!--[if lte IE 6]&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
//Flag browser as IE in our conditional comment block
ie6 = true;
ie = true;
&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;

&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
if(ie6 == false)
{
	alert(&amp;quot;You're cool, you're not using IE6&amp;quot;);
} else {
	alert(&amp;quot;Ahh! Why are you using IE6!?!?&amp;quot;);
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/55/"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;Target All Versions of IE In Javascript&lt;/h3&gt;

&lt;p&gt;We could also target all versions of IE with the following code:&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
var ie = false;
&amp;lt;/script&amp;gt;

&amp;lt;!--[if IE]&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
ie = true;
&amp;lt;/script&amp;gt;
&amp;lt;![endif]--&amp;gt;

&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
if(ie == false)
{
	alert(&amp;quot;You're cool, you're not using IE&amp;quot;);
} else {
	alert(&amp;quot;Ahh! Why are you using IE!?!?&amp;quot;);
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Drawbacks&lt;/h3&gt;

&lt;p&gt;There are a few drawbacks to this method. First, the conditional comment code will all have to appear inline on each page its used. I suppose one could create an external .js file and wrap 
it with the conditional comments. Second, we'll have to account for all the versions of IE we want to target or at least use LTE/GTE to target IE6/IE7 and its previous versions.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=55"&gt;View Comments [7]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/McZKfNxaktQ" height="1" width="1"/&gt;</description>
<pubDate>Tue, 14 Jul 2009 19:49:42 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=55</guid>
<author>Neal Grosskopf</author>
<category>javascript</category><category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=55</feedburner:origLink></item>
<item>
<title>Emulate C#'s AppendFormat Method In Javascript Or Classic ASP</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/M74Of1mza8I/thread.php</link>
<description>&lt;p&gt;Let me preface this article with the statement that I am by no means a 'good' C# programmer. I've used it a bit at work (we're currently transitioning to it) so I've seen it here and there. 
I know a fair amount about Classic ASP however, so when I noticed a neat little feature in C#/ASP.NET I wanted to see if I could mimic it in other languages.&lt;/p&gt;

&lt;h3&gt;AppendFormat Method&lt;/h3&gt;

&lt;p&gt;The method in C# is called AppendFormat. It belongs to the System.text namespace which contains the StringBuilder class and AppendFormat is a method of this. Here's the 
&lt;a href="http://msdn.microsoft.com/en-us/library/system.text.stringbuilder.appendformat.aspx"&gt;MSDN article&lt;/a&gt; if you'd like to find out more about it.&lt;/p&gt;

&lt;h3&gt;Old School Method&lt;/h3&gt;

&lt;p&gt;The neat thing about this method is it's an alternative to concatenation. Concatenation is basically the process of combining text and variables together like so:&lt;/p&gt;

&lt;code&gt;
var a = "lorem ipsum dolor"
var b = "adipiscing elit"
document.write(a + " sit amet consectetur " + b)
&lt;/code&gt;

&lt;p&gt;I think we're all pretty familiar with the code above. We're also probably familiar with some of the annoyances of the code above such as the fact that every time we combine text with a string variable, we need to start a quotation mark. 
Quotation marks are bothersome because sometimes (or rather often times in my case) we forget to properly close the ending quotation mark resulting in an error. More trouble can ensue when we have to start re-arranging variables and text 
within the concatenated string.&lt;/p&gt;

&lt;p&gt;Another problem is I often forget to include the concatenation symbol in between my text and variables. This, if anything, is probably the number one mistake I make.&lt;/p&gt;

&lt;h3&gt;Emulation Using Javascript&lt;/h3&gt;

&lt;p&gt;As I reviewed my co-workers C# code, I felt that perhaps C# had a good point so I set out to emulate this in other languages.&lt;/p&gt;

&lt;p&gt;First of all, below is the syntax we use for this alternative method. We use keyword itentifiers i.e. {NUMBER} to indicate an item should be placed in its spot. That number corresponds with the index of the array items on the right i.e NEAL, GROSSKOPF.
 The neat thing with this is we can easily move {0} arround without having to worry about closing the quotation marks and there is no need to use the concatenation symbol...ever!&lt;/p&gt;

&lt;code&gt;
AppendFormat("Lorem ipsum dolor sit {0} {1} amet, consectetur {0} adipiscing {0} elit.", ["NEAL", "GROSSKOPF"])
&lt;/code&gt;

&lt;p&gt;Below is the function I wrote to emulate this in Javascript. I pass the function an array, loop through it, and replace the placeholders with the array item in the same index.&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type="text/javascript"&amp;gt;
function AppendFormat(input,arr)
{
    for (i = 0; i &lt; arr.length; i++)
    {
		while (input.indexOf("{"+i+"}") != -1)
		{
			input = input.replace("{"+i+"}", arr[i]);
		}
    }
    return input;
}

document.write(AppendFormat("Lorem ipsum dolor sit {0} {1} amet, consectetur {0} adipiscing {0} elit.", ["NEAL", "GROSSKOPF"]));
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Easily Re-Arrange Items&lt;/h3&gt;

&lt;p&gt;The great thing about this, is we can easily re-arrange items simply by moving the placeholder around in the text block like so:&lt;/p&gt;

&lt;code&gt;
AppendFormat("Lorem ipsum dolor sit {1} {0} amet, consectetur {1} adipiscing {0} elit.", ["NEAL", "GROSSKOPF"]);
&lt;/code&gt;

&lt;h3&gt;Classic ASP Variant&lt;/h3&gt;

&lt;p&gt;I also wanted to create the same function but in Classic ASP, my language of choice:&lt;/p&gt;

&lt;code&gt;
function AppendFormat(input,arr)   
    for i = 0 to ubound(arr)
        input = replace(input,"{" &amp; i &amp; "}",arr(i))
    next   
    AppendFormat = input
end function

response.Write AppendFormat("Lorem ipsum dolor sit {0} {1} amet, consectetur {1} adipiscing {1} elit.", array("NEAL","GROSSKOPF"))
&lt;/code&gt;

&lt;p&gt;As you can see, this is pretty much the basic princple that we used for the Javascript version.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;I'm sure this article isn't as exciting as some of my others, and for all I know, most my readers are much better programmers than myself but I thought it was a cool idea so I wrote about it.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=54"&gt;View Comments [4]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/M74Of1mza8I" height="1" width="1"/&gt;</description>
<pubDate>Thu, 09 Jul 2009 07:03:53 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=54</guid>
<author>Neal Grosskopf</author>

<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=54</feedburner:origLink></item>
<item>
<title>How To Create CSS Text/Font Gradients With CSS</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/jXnr0Mqcew0/thread.php</link>
<description>&lt;p&gt;Something that CSS is currently lacking is the ability to add gradients to our text blocks. Currently we can add drop shadows to text or change the color of it but not add gradients. I suspect 
that in the coming years this will be a new property but until then here is a method to do it.&lt;/p&gt;

&lt;h3&gt;HTML Setup&lt;/h3&gt;

&lt;p&gt;The HTML Setup is pretty simple. Just place an empty SPAN element inside your heading element:&lt;/p&gt;

&lt;code&gt;
&amp;lt;h3&amp;gt;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;Text Here&amp;lt;/h3&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Using JQuery to Automatically Insert SPAN Elements&lt;/h3&gt;

&lt;p&gt;I think a few people might find the above code unsightly, so here's a method to leave the empty SPAN element out of your HTML and inject it via JQuery:&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
$(document).ready(function(){
	$(&amp;quot;h3&amp;quot;).prepend(&amp;quot;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;)
});
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;CSS Setup&lt;/h3&gt;

&lt;p&gt;The most important part of this code is setting the H3 element's position to relative. I'd also recommend setting the line-height to the same height as the font-size used and also reseting the margins back to zero.&lt;/p&gt;

&lt;code&gt;
h3
{
font-size: 25px;
line-height: 25px;
margin: 0px;
position: relative; 
}
&lt;/code&gt;

&lt;p&gt;Next, we position the empty SPAN element absolute and give it a height and width. Using this SPAN we can overlay various background-images over the H3 element.&lt;/p&gt;

&lt;code&gt;
h3 span
{
display: block;
height: 26px;
position: absolute;
width: 100%;
}
&lt;/code&gt;

&lt;h3&gt;Gradient Effect&lt;/h3&gt;

&lt;p&gt;The first effect I'll demonstrate is a simple gradient. To do this we use a simple &lt;a href="/tech/resources/53/gradient-white.png"&gt;white to transparent gradient image&lt;/a&gt; and set it as the SPAN element's background-image. We can then 
position the background-image higher or lower depending on how strong we want the effect to be.&lt;/p&gt;

&lt;code&gt;
h3 span { background: url(gradient-white.png) repeat-x left 0px; }
&lt;/code&gt;

&lt;div class="image-caption" style="width: 490px;"&gt;
	&lt;a href="/tech/resources/53/?demo=1"&gt;&lt;img src="/tech/resources/53/demo-1.png" alt="SPAN Element Overlay"&gt;&lt;/a&gt;
	&lt;p&gt;In the example above, the black transparent area represents the SPAN while the black border represents the bounds of the H3 element.&lt;/p&gt;
	&lt;h3&gt;Demo&lt;/h3&gt;
	&lt;p&gt;When viewing the demo, take your cursor and select the gradient text. This will give you a good understanding of how the gradient works - &lt;/p&gt;
	&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=1"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h3&gt;Gradient Effect With Hover&lt;/h3&gt;

&lt;p&gt;We can also apply a color change on hover with our gradient. Since the color change happens on the layer &lt;b&gt;behind&lt;/b&gt; the gradient there is no additional CSS we must do other than change the H3's color when hovered.&lt;/p&gt;

&lt;code&gt;
h3 span { background: url(gradient-white.png) repeat-x left 0px; }
h3:hover { color: #990000; }
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=2"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;Two Tone Effect&lt;/h3&gt;

&lt;p&gt;Another effect we can do is apply a two toned text color to our text. To do this we use a white rectangle with it's opacity lowered and then position it over our H3.&lt;/p&gt;

&lt;code&gt;
h3 span { background: url(dual-white.png) repeat-x left 0px; }
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=3"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h3&gt;Sliding Door Effect&lt;/h3&gt;

&lt;p&gt;Finally, my last effect uses JQuery to create an animation when the text is hovered. Using a little JQuery we can slide the SPAN's background-image up and down when hovered on
giving it sort of a 'garage door' effect.&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://jqueryjs.googlecode.com/svn/trunk/plugins/backgroundPosition/jquery.backgroundPosition.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
$(document).ready(function(){
	$(&amp;quot;h3 span&amp;quot;).hover(
		function () {
			$(this).stop().animate({backgroundPosition: &amp;quot;(0px -27px)&amp;quot;}, 400); 
		}, 
		function () {
			$(this).stop().animate({backgroundPosition: &amp;quot;(0px 0px)&amp;quot;}, 400);
		}
	);
});
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/53/?demo=4"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Got any other effects that could be accomplished using a background-image? Share them below!&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=53"&gt;View Comments [1]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/jXnr0Mqcew0" height="1" width="1"/&gt;</description>
<pubDate>Wed, 01 Jul 2009 20:04:44 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=53</guid>
<author>Neal Grosskopf</author>
<category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=53</feedburner:origLink></item>
<item>
<title>Firefox 3.5 Set To Be Released Tuesday. Here Are Some Exciting New CSS Features In 3.5</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/0v02CariXws/thread.php</link>
<description>&lt;div class="image-caption" style="width: 235px; float: right; margin: 0px 0px 20px 20px;"&gt;	
	&lt;img src="/tech/resources/52/firefox.jpg" alt="Firefox 3.5"&gt;	
	&lt;h3&gt;Firefox 3.5&lt;/h3&gt;	
	&lt;p&gt;Firefox 3.5 looks to have plenty of new features for web developers to play with. I'll go over some of new CSS features that are new to 3.5.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;For much of my web career I've been an Internet Explorer stooge but when Firefox 3 came out last summer, I made the switch and never looked back. Firefox is just so heavily oriented to 
web developers and designers that it's hard to rationalize using any other browser. Sure, Opera and Safari have slightly better support but their lack of developer tools make me opt for Firefox.&lt;/p&gt;

&lt;p&gt;Firefox 3.5, the latest version of the browser is set to be released this Tuesday. This intermediary release is probably aimed more at developers than end users and that's what excites me the most. After 
reviewing the &lt;a href="https://developer.mozilla.org/En/Firefox_3.5_for_developers"&gt;3.5 release notes&lt;/a&gt; I thought I'd point out a few of the new features that I'm most excited about.&lt;/p&gt;

&lt;h3&gt;@font-face Support&lt;/h3&gt;

&lt;p&gt;Since the inception of the web, we've been limited to about a dozen font types. With @font-face we're now able to choose from 1000's if not more. By embedding fonts our sites will be more accessible 
to people with screen readers, and it will also improve our search engine optimization by using pure text rather than images. This will also make our lives easier because we'll be able to change 
font properties via CSS rather than having to open up Photoshop or Fireworks to edit an image file.&lt;/p&gt;

&lt;p&gt;Currently browsers using Webkit also support @font-face and Opera 10 will support it. Internet Explorer has it's own proprietary method.&lt;/p&gt;

&lt;code&gt;
@font-face
{
font-family: "Bitstream Vera Serif Bold";
src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");
}

body { font-family: "Bitstream Vera Serif Bold", serif }
&lt;/code&gt;

&lt;h3&gt;Box Shadow &amp;amp; Text Shadow&lt;/h3&gt;

&lt;p&gt;A personal favorite of mine is the box-shadow property. Creating drop shadows on the web can be pretty painful, especially when the size of the box may vary from page to page. With the 
new box shadow property we won't need to worry about that anymore. Safari also supports box-shadow while Opera and IE do not. Firefox 3.5 will also support text-shadow (with no -mox prefix). This means that Opera, Safari and Firefox 
all support this while IE, again has it's own proprietary method.&lt;/p&gt;

&lt;code&gt;
div {  -moz-box-shadow: #000 10px 5px 5px; }
h2 { text-shadow: #000 1px 1px 2px; }
&lt;/code&gt;

&lt;h3&gt;CSS Transformations&lt;/h3&gt;

&lt;p&gt;Originally introduced by Safari/Webkit we now have the ability to use CSS Transformations. I haven't delved into this much but I have used CSS Transitions a few times on various projects which I wish 
they would have implemented instead.&lt;/p&gt;

&lt;h3&gt;New CSS Selectors&lt;/h3&gt;

&lt;p&gt;Probably the most important aspect of CSS is the ability to select elements. Firefox 3.5 gives us a few more tools to achieve this. Having used JQuery extensively for the past several months, I've 
found myself using almost all of these to circumvent browser's lack of support. With Firefox 3.5 we'll be able to natively use these selectors (and more):&lt;/p&gt;

&lt;code&gt;
/* Zebra Stripes */
tr:nth-child(odd) { background: #fff; }
tr:nth-child(even) { background: #eee }

/* Alternate Method for Zebra Stripes */
tr:nth-of-type(odd) { background: #fff; }
tr:nth-of-type(even) { background: #eee }

/* Last 5 LIs of a List */
li:nth-last-child(-n+5) { color: #ccc; }

/* Alternate Method */
li:nth-last-of-type(5) { color: #ccc; }
&lt;/code&gt;

&lt;h3&gt;CSS Media Queries&lt;/h3&gt;

&lt;p&gt;Media queries allows web developers to target certain scenarios that end users may have. For instance in the example below I'm adjusting the width of my #content DIV if 
the end user is on a PDA and has a screen size smaller than 300px.&lt;/p&gt;

&lt;code&gt;
@media handheld and (max-width: 300px)
{
#content { width: 300px; }
}
&lt;/code&gt;

&lt;p&gt;You could also take this a step further and mine for information about your end users by testing the size of elements on your page:&lt;/p&gt;

&lt;code&gt;
&amp;lt;style type=&amp;quot;text/css&amp;quot;&amp;gt;
@media handheld and (max-width: 300px)
{
#content { width: 300px; }
}
&amp;lt;/style&amp;gt;

&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
if ($(#content).width() = "300px")
{
//do something, i.e. email, write to text file etc.
}
&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;h3&gt;Other New CSS Features&lt;/h3&gt;

&lt;p&gt;Here's a list of a few other CSS features I didn't mention above.&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;opacity (no longer -moz-opacity)&lt;/li&gt;
	&lt;li&gt;word-wrap&lt;/li&gt;
	&lt;li&gt;-moz-border-image&lt;/li&gt;
	&lt;li&gt;-moz-column-rule&lt;/li&gt;
	&lt;li&gt;-moz-column-rule-width&lt;/li&gt;
	&lt;li&gt;-moz-column-rule-style&lt;/li&gt;
	&lt;li&gt;-moz-column-rule-color&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Further Reading:&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="https://developer.mozilla.org/En/Firefox_3.5_for_developers"&gt;Firefox 3.5 for Developers&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)"&gt;Comparison of Layout Engines (CSS) - Wikipedia&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="http://www.w3.org/TR/css3-selectors/"&gt;CSS 3 Selectors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=52"&gt;View Comments [0]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/0v02CariXws" height="1" width="1"/&gt;</description>
<pubDate>Sun, 28 Jun 2009 21:22:58 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=52</guid>
<author>Neal Grosskopf</author>

<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=52</feedburner:origLink></item>
<item>
<title>YouTube Hacking: How To Retrieve Video Screenshots From YouTube Videos</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/EbtZhDiCbH0/thread.php</link>
<description>&lt;p&gt;It is often useful to display a preview of an embedded YouTube video on your website rather than the long winded HTML object/embed code. Fortunately YouTube provides us with an undocumented way to retrieve video stills.&lt;/p&gt;

&lt;p&gt;Each video has three separate stills that you can choose from after you upload the video. YouTube, now also support high definition videos and because of that, provides higher quality stills as well. Below I will run through all the various 
YouTube images that are available for each video.&lt;/p&gt;

&lt;h3&gt;The Setup&lt;/h3&gt;

&lt;p&gt;Below is a break down of the YouTube URL. For all of my examples I have chosen my new favorite YouTube video &lt;a href="http://www.youtube.com/watch?v=nda_OSWeyn8"&gt;Leprechaun in Mobile, Alabama&lt;/a&gt;.&lt;/p&gt;

&lt;table class="data"&gt;
&lt;caption&gt;Breakdown Of URL&lt;/caption&gt;
&lt;tr&gt;
	&lt;th&gt;Domain&lt;/th&gt;
	&lt;th&gt;Folder&lt;/th&gt;
	&lt;th&gt;Video&lt;/th&gt;
	&lt;th&gt;Image&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;http://i.ytimg.com&lt;/td&gt;
	&lt;td&gt;/vi/&lt;/td&gt;
	&lt;td&gt;nda_OSWeyn8&lt;/td&gt;
	&lt;td&gt;default.jpg&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;The Default YouTube Image&lt;/h3&gt;

&lt;p&gt;YouTube's default video image, i.e. the image that the uploader has chosen, can be retrieved by using the default.jpg image. Its dimensions are 120px x 90px and its file size is 3.07KB. You may want to use this image when you want the exact image the 
original uploader intended.&lt;/p&gt;


&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/default.jpg" alt="default.jpg" class="frame"&gt;


&lt;h3&gt;Series Images 0 - 4 &lt;/h3&gt;

&lt;p&gt;Next YouTube provides us with images 0.jpg, 1.jpg, 2.jpg &amp;amp; 3.jpg. These 4 images are basically the 4 images the uploader can chose from after uploading a video.&lt;/p&gt;

&lt;p&gt;Image 0.jpg is larger, sized at 320px x 240px and its file size is 11.77KB.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/0.jpg" alt="0.jpg" class="frame"&gt;&lt;/p&gt;

&lt;p&gt;Images 1, 2, 3 are smaller images sized at 130px x 97px.&lt;/p&gt;

&lt;p&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/1.jpg" alt="1.jpg" class="frame inline"&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/2.jpg" alt="2.jpg" class="frame inline"&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/3.jpg" alt="3.jpg" class="frame inline"&gt;
&lt;/p&gt;

&lt;h3&gt;High Quality Images&lt;/h3&gt;

&lt;p&gt;Next, YouTube provides us with what they label 'high quality' images. These are named hq1.jpg, hq2.jpg, hq3.jpg &amp;amp; finally hqdefault.jpg.&lt;/p&gt;

&lt;p&gt;Images 1, &amp;amp; 3 are smaller images sized at 130px x 97px. Even those these are prefixed with 'hq' the images appear to be of the same quality that images 1, 2, &amp;amp; 3 were.&lt;/p&gt;

&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hq1.jpg" alt="hq1.jpg" class="frame inline"&gt;
&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hq3.jpg" alt="hq3.jpg" class="frame inline"&gt;

&lt;p&gt;Image 2 is larger and sized at 480px x 360px. Its file size is 14.63KB. I'm not sure why this image is larger because it seems to break the pattern of the other images. It does appear to be the default image so perhaps that has something to do with it.&lt;/p&gt;

&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hq2.jpg" alt="hq2.jpg" class="frame"&gt;

&lt;p&gt;Finally, the hqdefault.jpg is the largest and highest quality of all the images. It is sized at 480px x 360px. Its file size is 14.63KB. I would recommend using this image as your primary image due to its quality.&lt;/p&gt;

&lt;img src="http://i.ytimg.com/vi/nda_OSWeyn8/hqdefault.jpg" alt="hqdefault.jpg" class="frame"&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;You now probably know more than you ever wanted to know about the available images YouTube provides us for each video. Feel free to bookmark this article as you'll probably need to refer back to it someday while working on a project.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=51"&gt;View Comments [8]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/EbtZhDiCbH0" height="1" width="1"/&gt;</description>
<pubDate>Wed, 10 Jun 2009 21:43:51 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=51</guid>
<author>Neal Grosskopf</author>
<category>youtube</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=51</feedburner:origLink></item>
<item>
<title>Quick &amp; Easy Ways To Spice Up Your Web Site's Font Styling</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/Z4bqRPQpuR0/thread.php</link>
<description>&lt;p&gt;One of the key elements of a good website design is the styling of the site's font. I think this is an area where many of the more 'mathematically inclined' web developers struggle. To help those out that 
are willing to take it, I'll show you how to take the default Times New Roman 16px font and make your design shine.&lt;/p&gt;

&lt;p&gt;By default browsers will apply the following settings to your font out of the box:&lt;/p&gt;

&lt;code&gt;
body
{
color: #000000;
font-family: "Times New Roman";
font-size: 16px;
letter-spacing: 0px;
line-height: 18px;
text-align: left;
}
&lt;/code&gt;

&lt;p&gt;We're all familiar with the appearance of this font, and often times, are turned off by this font styling because of how common and boring it looks.&lt;/p&gt;

&lt;h3&gt;Gray is the New Black&lt;/h3&gt;

&lt;p&gt;First lets get rid of that default and obnoxious font color #000000. I recommend you choose a value between #888888 and #333333 for your website's font color. If you need help picking a color I recommend 
using &lt;a href="http://meyerweb.com/eric/tools/color-blend/"&gt;Eric Meyer's Color Blend Tool&lt;/a&gt;. I would also like to point out that using a color lighter than #888888 will not have enough contrast on a 
white background and will be difficult for your users to read. On the flip side, a color darker than #333333 is starting to get into that loud and obnoxious range again. I personally like to 
choose #555555.&lt;/p&gt;

&lt;code&gt;
body
{
color: #555555;
}
&lt;/code&gt;

&lt;h3&gt;Times New What?&lt;/h3&gt;

&lt;p&gt;Next lets 'can' Times New Roman for a different, less 'plain' font. &lt;i&gt;A side note, Times New Roman is a great font, and there's a time and place for it, but being the browser default font, I tend to shy away from using 
it too often.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;Font types can also be broke into two different groups. Serif and Sans Serif. Sans serifs fonts do not have the small tails after letters. An example of a sans serif font is &lt;span style="font-family: Arial;"&gt;Arial&lt;/span&gt;. An example of a serif font is 
&lt;span style="font-family: 'Times New Roman';"&gt;Times New Roman&lt;/span&gt;. Below is a list of some of the more content-useful fonts to chose from when designing a website. Notice how some of the fonts take up more space than others:&lt;/p&gt; 

&lt;h4&gt;Sans Serif&lt;/h4&gt;

&lt;ol style="font-size: 20px;"&gt;
	&lt;li style="font-family: Arial;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Arial&lt;/li&gt;
	&lt;li style="font-family: Verdana;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Verdana&lt;/li&gt;
	&lt;li style="font-family: Tahoma;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Tahoma&lt;/li&gt;	
	&lt;li style="font-family: 'Trebuchet MS';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Trebuchet MS&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;Serif&lt;/h4&gt;

&lt;ol style="font-size: 20px;"&gt;	
	&lt;li style="font-family: 'Times New Roman';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Times New Roman&lt;/li&gt;
	&lt;li style="font-family: Georgia;"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Georgia&lt;/li&gt;
	&lt;li style="font-family: 'Palatino Linotype';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Palatino Linotype&lt;/li&gt;
	&lt;li style="font-family: 'Lucida Sans';"&gt;ABCDEFGHIJKLMNOPQRSTUVWXYZ - Lucida Sans&lt;/li&gt;	
&lt;/ol&gt;

&lt;p&gt;Of the choices above, I find Arial to be the easiest on the eyes. If you want to be a bit edgier you can chose fonts 2-4 which are used a bit less than the others.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Need help?&lt;/b&gt; Check out my extremely useful &lt;b&gt;&lt;a href="/tech/resources/50/font-comparison.asp"&gt;Font Comparison Page&lt;/a&gt;&lt;/b&gt; to see which font you like best.&lt;/p&gt;
 
&lt;h3&gt;Size Matters&lt;/h3&gt;

&lt;p&gt;By default browsers will assign your font a font-size of 16px. While 16px is big enough that most users will find it comfortable to read, 12px is really the internet's de facto font-size. Visit some of your favorite websites and you'll discover that almost all of them
use 12px as the main content's font-size. It's perfectly ok to use other font sizes, but for your main content I'd stick with 12px - 14px.&lt;/p&gt;

&lt;code&gt;
body
{
font-size: 12px;
}
&lt;/code&gt;

&lt;h3&gt;Give Your Font Some Breathing Room With Line-Height&lt;/h3&gt;

&lt;p&gt;Probably the single most easy CSS change you can make to your font, with the biggest impact, is to adjust your line-height. Line-Height is the spacing between the lines of text on your web pages. By default browsers set this to 18px. At 18px you will have about
9px of space between your top and bottom line.&lt;/p&gt;

&lt;div class="image-caption" style="width: 545px;"&gt;
	&lt;a href="/tech/resources/50/line-height.png"&gt;&lt;img src="/tech/resources/50/line-height.png" alt="Line Height Comparison"&gt;&lt;/a&gt;	
	&lt;h3&gt;Line Height Comparison&lt;/h3&gt;	
	&lt;p&gt;The first block of text has the default line-height of 18px while the second block has a line-height of 27px. Notice how the second block of text is easier to read.&lt;/p&gt;	
&lt;/div&gt;

&lt;h3&gt;Straighten Out With Text-Align: Justify&lt;/h3&gt;

&lt;p&gt;My final recommendation is to experiment with the CSS property text-align, specifically with the justify value. By default, browsers will assign the value of text-align: left; to your text. Using the value of 'justify' we can make all of our blocks of text 
have straight edges on the left and right.&lt;/p&gt;

&lt;div class="image-caption" style="width: 455px;"&gt;
	&lt;a href="/tech/resources/50/text-align.png"&gt;&lt;img src="/tech/resources/50/text-align.png" alt="Text Align Comparison"&gt;&lt;/a&gt;	
	&lt;h3&gt;Text Align Comparison&lt;/h3&gt;	
	&lt;p&gt;The first block has text-align: left; while the second block has text-align: justify; I find that the justified text helps reinforce the grid layout in your web design.&lt;/p&gt;	
&lt;/div&gt;

&lt;h3&gt;Putting It All Together&lt;/h3&gt;

&lt;p&gt;Below is a summary of everything I've just went through. Also check out my &lt;a href="/tech/resources/50/results.asp"&gt;step by step results page.&lt;/a&gt;&lt;/p&gt;

&lt;code&gt;
body
{
color: #555555;
font-family: Arial;
font-size: 12px;
line-height: 27px;
text-align: justify;
}
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/50/results.asp"&gt;View the metamorphoses from Times New Roman to my example above. &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=50"&gt;View Comments [3]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/Z4bqRPQpuR0" height="1" width="1"/&gt;</description>
<pubDate>Wed, 03 Jun 2009 21:41:27 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=50</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>font</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=50</feedburner:origLink></item>
<item>
<title>Browser Comparison of Available Print Area Width</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/ytDDyZYbAIU/thread.php</link>
<description>&lt;p&gt;This article is a companion article to my "&lt;a href="/tech/thread.asp?pid=43"&gt;Browser Comparision of Available Screen Width When Using 1024x768&lt;/a&gt;" which I think many people found useful. The other day at work a co-worker complained to me that
a webpage was getting cropped off when printing it. I then had to tinker with the width of a few different elements on the page to get it to fit. After finishing that I began to wonder, what the max-width is that can be used various browsers when printing.&lt;/p&gt;

&lt;p&gt;I ran a quick test of all the browsers I had installed to see at what width, would the browser's print preview window crop off my fixed width DIV. Here are the results I found:&lt;/p&gt;

&lt;table class="data"&gt;
&lt;caption&gt;Browser Comparision of Available Print Area Width&lt;/caption&gt;
&lt;tr&gt;
	&lt;th&gt;Browser&lt;/th&gt;
	&lt;th&gt;Max-Width&lt;/th&gt;
	&lt;th&gt;Default Settings&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Firefox 3 @ 100%&lt;/td&gt;
	&lt;td&gt;686px&lt;/td&gt;
	&lt;td&gt;Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Safari 4&lt;/td&gt;
	&lt;td&gt;718px&lt;/td&gt;
	&lt;td&gt;&gt; 718px Triggers Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;Opera 9.5 @ 100%&lt;/td&gt;
	&lt;td&gt;730px&lt;/td&gt;
	&lt;td&gt;80% &amp; Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;IE8 @ 100%&lt;/td&gt;
	&lt;td&gt;670px&lt;/td&gt;
	&lt;td&gt;Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;IE7 @ 100%&lt;/td&gt;
	&lt;td&gt;670px&lt;/td&gt;
	&lt;td&gt;Shrink To Fit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;IE6 @ 100%&lt;/td&gt;
	&lt;td&gt;670px&lt;/td&gt;
	&lt;td&gt;75%&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h4&gt;Notes On My Results&lt;/h4&gt;

&lt;p&gt;You'll notice that many browser's default settings are set to 'shrink to fit'. This may solve the problem of extra-wide content when printing most of the time. I also decided, that when given the option, I would set the resize option to 100% to make all my 
browsers equal.&lt;/p&gt;

&lt;p&gt;Also when I ran the test, I did not modify the page's margins which I'm sure would have an affect on the results.  Safari also had an interesting feature that triggered shrink to fit when the content grew beyong it's max-width. 
I thought this was a pretty useful feature compared to most the other browsers.&lt;/p&gt;

&lt;p&gt;Other results we can see, is Internet Explorer has stayed tried and true throughout it's past three versions sticking with 670px each time as it's max-width. Opera provides the most real-estate at 730px.&lt;/p&gt;

&lt;h4&gt;Conclusion&lt;/h4&gt;

&lt;p&gt;When writing print stylesheets knowing that the lowest common deneminator is Internet Explorer at 670px will help you when creating print stylesheets.&lt;/p&gt;

&lt;h4&gt;Related Articles&lt;/h4&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href="/tech/thread.asp?pid=43"&gt;Browser Comparision of Available Screen Width When Using 1024x768&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.asp?pid=39"&gt;Go Green With CSS Print Stylesheets&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href="/tech/thread.asp?pid=8"&gt;Using Media Targeting With CSS With @Media&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=49"&gt;View Comments [1]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/ytDDyZYbAIU" height="1" width="1"/&gt;</description>
<pubDate>Tue, 26 May 2009 18:35:04 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=49</guid>
<author>Neal Grosskopf</author>
<category>browser comparision</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=49</feedburner:origLink></item>
<item>
<title>Gallery of Yahoo.com's Year Long Home Page Redesign</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/4KsEy2QSCSE/thread.php</link>
<description>&lt;div class="image-caption" style="width: 216px; float: right; margin: 0px 0px 15px 15px;"&gt;
	&lt;img src="/tech/resources/48/yahoo_logo.png" alt="Yahoo!" class="frame"&gt;
	&lt;h3&gt;Yahoo! Redesign&lt;/h3&gt;
	&lt;p&gt;Yahoo! has been in the midst of &lt;a href="http://kara.allthingsd.com/20090214/how-is-yahoos-massive-metro-homepage-redesign-going-it-depends-on-who-you-ask/"&gt;redesigning their home page&lt;/a&gt; since &lt;a href="http://kara.allthingsd.com/20080917/a-first-look-at-the-new-yahoo-homepage-redesign-apps-rule/"&gt;September of 2008&lt;/a&gt;. Their last redesign was in August of 2006.&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;I've been using Yahoo! since 1996, and over the years I've become quite attached to my beloved Yahoo! even when users started to ditch them for
other websites. So, it's natural for me to get excited when Yahoo! gives me a sneak peak at their new home page (usually located at m.www.yahoo.com).&lt;/p&gt;

&lt;p&gt;One reason that I still like Yahoo! is I am primarily a designer...not a developer. As a designer, I'm drawn to websites that have more design elements and style. This is one reason why I prefer Yahoo! 
to Google. I feel that Yahoo! has a bit more personality compared to Google. For more on that see - &lt;a href="http://blog.fawny.org/2009/03/19/google-antidesign/"&gt;http://blog.fawny.org/2009/03/19/google-antidesign/&lt;/a&gt;. 
Still, I won't deny that Google has a superior search engine.&lt;/p&gt;

&lt;p&gt;What confuses me, is I have been randomly getting these 'sneak peaks' since last November. I'm starting to wonder if Yahoo! will ever release their newly improved home page. 
Every time I get a sneak peak I take a screenshot to compare to my last screenshot. Now that I have a couple different screenshots I thought I'd share them with the rest of the world.&lt;/p&gt;

&lt;h4&gt;Yahoo! Today&lt;/h4&gt;

&lt;p&gt;First, let's check out the current home page of the site, which has been their design since August of 2006.&lt;/p&gt;

&lt;a href="/tech/resources/48/yahoo_current.jpg"&gt;&lt;img src="/tech/resources/48/yahoo_current_thumb.jpg" alt="Yahoo! Currently" class="frame"&gt;&lt;/a&gt;

&lt;div class="hr"&gt;&lt;hr&gt;&lt;/div&gt;

&lt;h4&gt;November 2nd, 2008 Yahoo! Redesign&lt;/h4&gt;

&lt;p&gt;Here is the first screenshot I have from my collection. The site's main structure is very similar to the current site, but the major difference is the background gradient and the dark blue bar 
on the left of the page. The right hand applications area has also be redesigned.&lt;/p&gt;

&lt;a href="/tech/resources/48/yahoo_redesign_11-2-2008.jpg"&gt;&lt;img src="/tech/resources/48/yahoo_redesign_11-2-2008_thumb.jpg" alt="November 2nd, 2008 Yahoo! Redesign" class="frame"&gt;&lt;/a&gt;

&lt;div class="hr"&gt;&lt;hr&gt;&lt;/div&gt;

&lt;h4&gt;April 6th, 2009 Yahoo! Redesign&lt;/h4&gt;

&lt;p&gt;Yahoo's next iteration is once again a small evolution from the November design, except they softened the look of the their blue left navigation bar, which I think was a good decision. You'll also notice
  this version of the redesign is much wider than the previous version. I checked my screenshot and it's roughly 1165px wide. This seems like an odd width to choose unless of course, they are using a 
 min-width/max-width layout.&lt;/p&gt;
 
&lt;p&gt;Another interesting change in this version is the choice of Times New Roman/Georgia as a main font type. Times New Roman is rarely used since it's usually the browser's default font choice.&lt;/p&gt;

&lt;a href="/tech/resources/48/yahoo_redesign_4-6-2009.jpg"&gt;&lt;img src="/tech/resources/48/yahoo_redesign_4-6-2009_thumb.jpg" alt="April 6th, 2009 Yahoo! Redesign" class="frame"&gt;&lt;/a&gt;

&lt;div class="hr"&gt;&lt;hr&gt;&lt;/div&gt;

&lt;h4&gt;May 13th, 2009 Yahoo! Redesign&lt;/h4&gt;

&lt;p&gt;Then today, I opened up IE6 to test something out and was once again, given a sneak peak at another iteration of Yahoo's redesigned home page. This version is radically different than April's and November's,
but looks much closer to their current design. They also decided to loose the dark gradient background in favor of a softer gradient. Also, the right hand applications area has been removed in favor of a 'top searches' 
content area. The applications were then moved to the left bar. I think this version will be an easier transition for people favoring their current design.&lt;/p&gt;

&lt;a href="/tech/resources/48/yahoo_redesign_5-13-2009.jpg"&gt;&lt;img src="/tech/resources/48/yahoo_redesign_5-13-2009_thumb.jpg" alt="May 13th, 2009 Yahoo! Redesign" class="frame"&gt;&lt;/a&gt;

&lt;h4&gt;Wrap Up&lt;/h4&gt;

&lt;p&gt;It's interesting to see the various interations of Yahoo's redesign process. It almost appears they are coming full circle back to their current design with a few modifications.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;What do you think of Yahoo's redesigned website?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=48"&gt;View Comments [1]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/4KsEy2QSCSE" height="1" width="1"/&gt;</description>
<pubDate>Wed, 13 May 2009 22:42:45 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=48</guid>
<author>Neal Grosskopf</author>

<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=48</feedburner:origLink></item>
<item>
<title>HTML Vs. BODY Element: What's the Difference?</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/MQM2iIl6JgI/thread.php</link>
<description>&lt;p&gt;I've always been interested in the subtle differences between the HTML and BODY elements when it comes to CSS. Many designers reference the two elements interchangeably in their stylesheets. 
Often times it's perfectly ok to place properties in either one, but there are certain instances where you'll want to chose one over the other.&lt;/p&gt;

&lt;h4&gt;Default Rendering of HTML and BODY Elements&lt;/h4&gt;

&lt;p&gt;By default, all major browsers assign the BODY element a margin of 8px. We often see this in CSS resets, setting the margin back to 0px. As far as I'm aware there is no other default CSS applied to either elements other than your usual font-size, color etc. 
The HTML element, in comparison, has a margin set to 0px. Also neither of the two elements have padding, which is often seen in CSS resets as well.&lt;/p&gt;

&lt;code&gt;
html { margin: 0px; }
body { margin: 8px; }
&lt;/code&gt;

&lt;h4&gt;Overflow/Scrollbars&lt;/h4&gt;

&lt;p&gt;Another thing I like to place in my stylesheets is some CSS to always display browser scrollbars. I do this because it annoys me when I browse to one page that has a lot of content and then browse to another page that has little content, and
my main content DIV is bouncing back and forth. In order to fix this you need to place 'overflow-y: scroll;' on your HTML element. If this property is assigned to the BODY element, nothing 
happens and it will not work, thus another big difference between the two elements.&lt;/p&gt;

&lt;code&gt;
html { overflow-y: scroll; }
&lt;/code&gt;

&lt;h4&gt;Scrollbar Colors: HTML or BODY?&lt;/h4&gt;

&lt;p&gt;In Internet Explorer the scrollbar color properties need to be applied to the HTML element rather than the BODY element in order to work. Safari has also added scrollbar styling in their recent build, so 
we'll have to see how they implemented this as well.&lt;/p&gt;

&lt;code&gt;
html
{
scrollbar-face-color: #000; 
scrollbar-highlight-color: #ccc; 
scrollbar-3dlight-color: #999; 
scrollbar-darkshadow-color: #666; 
scrollbar-shadow-color: #555; 
scrollbar-arrow-color: #fff; 
scrollbar-track-color: #ddd;
}
&lt;/code&gt;

&lt;h4&gt;Background Images and Colors&lt;/h4&gt;

&lt;p&gt;Another major difference between the HTML element and the BODY element is background-colors and background-images. The BODY element mimics the default behavior of a DIV element. It's 
height relies on the content within it. The HTML element on the other hand, spans the entire viewport regardless of the content within it. If you set a background-image to the BODY element and position it bottom,
it may not have the desired effect you intended, while the HTML element's background-image will fall at the bottom of the screen regardless of the content within it.&lt;/p&gt;

&lt;img src="/tech/resources/47/html_vs_body.png" alt="BODY Vs. HTML Element Background Colors"&gt;

&lt;h4&gt;In Conclusion&lt;/h4&gt;

&lt;p&gt;Probably the biggest take-away from this article would be background-images. I almost always use both the HTML and BODY elements to apply background-images to, and it's good to remember that the BODY element may not always hit the 'bottom' of the viewport.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Know of any other differences? Share your thoughts below...&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=47"&gt;View Comments [4]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/MQM2iIl6JgI" height="1" width="1"/&gt;</description>
<pubDate>Sun, 10 May 2009 20:02:04 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=47</guid>
<author>Neal Grosskopf</author>
<category>html</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=47</feedburner:origLink></item>
<item>
<title>CSS Template Layouts: A Simpler CSS Layout System, Now Possible With JQuery</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/5CEfkKy5Gi4/thread.php</link>
<description>&lt;div class="image-caption" style="width: 235px; float: right; margin: 0px 0px 20px 20px;"&gt;	
	&lt;img src="/tech/resources/46/grid-example.png" alt="Grid Example"&gt;	
	&lt;h3&gt;Skip To Demos:&lt;/h3&gt;
	&lt;ol&gt;
		&lt;li&gt;&lt;a href="/tech/resources/46/?demo=1"&gt;Basic Template Layout&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/tech/resources/46/?demo=2"&gt;Reversed Basic Template Layout&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/tech/resources/46/?demo=3"&gt;2 Columns With Header &amp;amp; Footer&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/tech/resources/46/?demo=4"&gt;3 Columns With Header &amp;amp; Footer&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/tech/resources/46/?demo=5"&gt;Easily Re-Arrange Columns&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="/tech/resources/46/?demo=6"&gt;Easily Re-Arrange Rows&lt;/a&gt;&lt;/li&gt;
	&lt;/ol&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b class="highlight"&gt;Updated May 6th:&lt;/b&gt; For the longest time I've been waiting for browsers to support the CSS Template Layout module. Today, I found out that &lt;a href="http://a.deveria.com/?p=236"&gt;Alexis Deveria&lt;/a&gt; has given the web community the 
gift we've all been waiting for. Using JQuery and a plugin we can now take full advantage of the &lt;a href="http://www.w3.org/TR/css3-layout/"&gt;CSS Template Layout Module&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Historically, we've used containers and floats to create our websites but with this method we may possibly be able to make that method history. With template layouts we 
can finally have &lt;b&gt;source order independence&lt;/b&gt; that has plagued the &lt;a href="http://www.sitepoint.com/books/csswrong1/"&gt;CSS Display: Table&lt;/a&gt;, &lt;a href="http://www.flownet.com/ron/css-rant.html"&gt;HTML TABLEs&lt;/a&gt; and CSS Float techniques. 
We can also ignore absolute position methods which I've always disliked. Finally the template layout method also handles equal column heights right out of the box.&lt;/p&gt;

&lt;h4&gt;Recap: Template Layout Gives Us&lt;/h4&gt;

&lt;ul&gt;
	&lt;li&gt;Pure source order independence&lt;/li&gt;
	&lt;li&gt;Equal height columns&lt;/li&gt;
	&lt;li&gt;No need to overflow containers&lt;/li&gt;
	&lt;li&gt;No need for hacks&lt;/li&gt;
	&lt;li&gt;Advanced grid layouts &lt;/li&gt;
	&lt;li&gt;Easy source arrangement for different media types i.e print, mobile&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;A Quick Overview&lt;/h4&gt;

&lt;p&gt;Template layout works like a grid. We're all familiar with the dozens of CSS libraries that attempt to give designers a grid to work with. I personally despise CSS libraries but that's another 
story. With template layout we can create all of those complex grids that designers dreamed up with HTML TABLEs, but using only CSS and semantic HTML instead.&lt;/p&gt;

&lt;h4&gt;Step 1: Importing JQuery and the Plugin&lt;/h4&gt;

&lt;p&gt;The very first thing we'll need to do is import JQuery and the JQuery Template Layout Plugin&lt;/p&gt;

&lt;code&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;http://css-template-layout.googlecode.com/files/jquery.tpl_layout1.1.1.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&lt;/code&gt;

&lt;p&gt;Next we'll need to initialize the plugin using JQuery's document.ready event:&lt;/p&gt;

&lt;code&gt;
$(document).ready(function()
{
$.setTemplateLayout()
});
&lt;/code&gt;

&lt;h4&gt;HTML Setup&lt;/h4&gt;

&lt;p&gt;The HTML setup can be approached in the same fashion we would approach the old float based layout system. For the sake of this tutorial I've named my DIVs a, b, c, d, e rather than header, nav, 
content, aside and footer.&lt;/p&gt;

&lt;code&gt;
&amp;lt;div id=&amp;quot;template&amp;quot;&amp;gt;
	&amp;lt;div id=&amp;quot;a&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; 
	&amp;lt;div id=&amp;quot;b&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; 
	&amp;lt;div id=&amp;quot;c&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; 
	&amp;lt;div id=&amp;quot;d&amp;quot;&amp;gt;&amp;lt;/div&amp;gt; 
	&amp;lt;div id=&amp;quot;e&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;

&lt;h4&gt;CSS Setup&lt;/h4&gt;

&lt;p&gt;We start like we would with any other layout system by centering our main #template DIV and giving it a width. I chose 1000px simply because it's easier to do math with.&lt;/p&gt;

&lt;code&gt;
#template
{
margin: auto;
width: 1000px;
}
&lt;/code&gt;

&lt;h4&gt;Position: What?; Think Grid Placeholders&lt;/h4&gt;

&lt;p&gt;Next we need to assign each of our child DIVs a position name. Again for the sake of this demo I've given each DIV the same position name as it's ID name:&lt;/p&gt;

&lt;code&gt;
#a { position: a; }
#b { position: b; }
#c { position: c; }
#d { position: d; }
#e { position: e; }
&lt;/code&gt;

&lt;p&gt;Think of each position name like a variable that will be used to place each DIV in a grid. My code example above would probably look like this in a production environment:&lt;/p&gt;

&lt;code&gt;
#header { position: a; }
#nav { position: b; }
#content { position: c; }
#aside { position: d; }
#footer { position: e; }
&lt;/code&gt;

&lt;h4&gt;::Slot() Pseudo Class&lt;/h4&gt;

&lt;p&gt;Template Layouts introduces a new CSS pseudo class called ::slot(). Think of slots like a content placeholder. Only certain CSS properties can be applied to slots such as background colors and images.&lt;/p&gt;

&lt;code&gt;
#template::slot(a) { background: #eee; }
#template::slot(b) { background: #ddd; }
#template::slot(c) { background: #ccc; }
#template::slot(d) { background: #bbb; }
#template::slot(e) { background: #aaa; }
&lt;/code&gt;

&lt;h4&gt;Display: Grid:&lt;/h4&gt;

&lt;p&gt;Using our placeholder names we can arrange our DIVs in an equal height grid system using the following syntax:&lt;/p&gt;

&lt;code&gt;
#template { display: "abcde"; }
&lt;/code&gt;

&lt;p&gt;&lt;a href="/tech/resources/46/?demo=1" class="b"&gt;View demo of this code &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We could also easily re-arrange our DIVs by simply ordering the placeholder names like so:&lt;/p&gt;

&lt;code&gt;
#template { display: "edcba"; }
&lt;/code&gt;

&lt;p&gt;&lt;a href="/tech/resources/46/?demo=2" class="b"&gt;View demo of this code &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that what we just did is not possible using Sitepoint's &lt;del&gt;evil&lt;/del&gt; display: table; method, and is not &lt;i&gt;easily&lt;/i&gt; possible using the standard float system. It is possible with absolute positioned elements but
once again we're trying to avoid that.&lt;/p&gt;

&lt;h4&gt;Real World Example of Template Layouts&lt;/h4&gt;

&lt;p&gt;Until now, I've only shown you the basics of template layouts. I've found that new programming techniques often make little sense until put into a real-world perspective. Lets create a two column template layout:&lt;/p&gt;

&lt;code&gt;
#template
{
display:
"aa" /150px
"bc"
"dd"
250px 750px
;
}
&lt;/code&gt;

&lt;p&gt;&lt;a href="/tech/resources/46/?demo=3" class="b"&gt;View demo of this code &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A break down of that code:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Line 4 states that the "a" DIV should occupy 2 columns in our grid row and /150px states that it should have a height of 150px.&lt;/li&gt;
	&lt;li&gt;Line 5 states that the "b" DIV should occupy 1 slot in the left row column and "c" should  occupy the right column in row 2.&lt;/li&gt;
	&lt;li&gt;Line 6 states that the "d" DIV should occupy 2 columns&lt;/li&gt;
	&lt;li&gt;Line 7 states that the first column should be 250px wide and the second column 750px wide&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Easy 3 Column Layout With CSS&lt;/h4&gt;

&lt;p&gt;We can easily take our &lt;b&gt;same HTML structure&lt;/b&gt; and make it a three column layout with the template layout system:&lt;/p&gt;

&lt;code&gt;
#template
{
display: 
"aaa" /150px
"bcd"
"eee"
* 500px *
;
}
&lt;/code&gt;

&lt;p&gt;&lt;a href="/tech/resources/46/?demo=4" class="b"&gt;View demo of this code &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A break down of that code:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Line 4 states that the "a" DIV occupies 3 slots in our grid and have a height of 150px; This is our #header.&lt;/li&gt;
	&lt;li&gt;Line 5 states that the "b" DIV occupies slot 1, of row 2, the "c" DIV occupies slot 2 of row 2 and finally the "d" DIV occupies slot 3 of row 2.  "b" is our #nav, "c" is our #content and "d" is our #aside.&lt;/li&gt;
	&lt;li&gt;Line 6 states that the "e" DIV occupies 3 slows of row 3. This DIV acts as our #footer.&lt;/li&gt;
	&lt;li&gt;Line 7 states that both	column 1 and column 3 have a variable width (250px) while the second column has a width of 500px consuming the rest of the available space.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Easily Re-Arrange Columns&lt;/h4&gt;

&lt;p&gt;The best thing about this approach is we can quickly re-arrange our content in the grid. This might come in handy when displaying content to different media types such as @print and @handheld. Take 
a look at how easy we could switch our columns around:&lt;/p&gt;

&lt;code&gt;
#template
{
display: 
"aaa" /150px
"dcb"
"eee"
* 500px *
;
}
&lt;/code&gt;

&lt;p&gt;&lt;a href="/tech/resources/46/?demo=5" class="b"&gt;View demo of this code &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Easily Re-Arrange Rows&lt;/h4&gt;

&lt;p&gt;If ever needed, we could also flip our #header and #footer DIVs like so:&lt;/p&gt;

&lt;code&gt;
#template
{
display: 
"eee" /150px
"dcb"
"aaa"
* 500px *
;
}
&lt;/code&gt;

&lt;p&gt;&lt;a href="/tech/resources/46/?demo=6" class="b"&gt;View demo of this code &amp;gt;&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;Argument Against Using This?&lt;/h4&gt;

&lt;p&gt;I can think of a few reasons not to use this:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Requires Javascript &amp;amp; JQuery&lt;/li&gt;
	&lt;li&gt;Layout not triggered until the DOM is loaded&lt;/li&gt;
	&lt;li&gt;Not thoroughly tested in all browsers (IE6 specifically)&lt;/li&gt;
	&lt;li&gt;Syntax has a high learning curve at first&lt;/li&gt;
	&lt;li&gt;Currently no browsers (that I'm aware of) support this natively&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Should You Use This?&lt;/h4&gt;

&lt;p&gt;Absolutely! While I'm unsure if this is ready for large &amp;amp; complicated designs I think as a community we should start testing this new approach out which is currently in the working draft stage 
of the W3C spec process.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Love it? Hate it? Speak your mind below...&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=46"&gt;View Comments [19]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/5CEfkKy5Gi4" height="1" width="1"/&gt;</description>
<pubDate>Wed, 06 May 2009 22:07:45 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=46</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>css3</category><category>jquery</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=46</feedburner:origLink></item>
<item>
<title>Create a JQuery Content Slider Using Pure CSS</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/E-fuuRUcPBQ/thread.php</link>
<description>&lt;p&gt;I've been working with JQuery a lot lately, both at work and at home, although my primary specialty is CSS, usually complex CSS. I have so far created several '&lt;a href="http://route.huebsch.com/"&gt;JQuery&lt;/a&gt; &lt;a href="/pages/about.asp"&gt;Sliders&lt;/a&gt;' as 
I like to call them. Then the thought occurred to me, could a JQuery Slider be created using only CSS?&lt;/p&gt;

&lt;div class="image-caption" style="width: 550px;"&gt;
	&lt;a href="/tech/resources/45/"&gt;&lt;img src="/tech/resources/45/slider-example.jpg" alt="Slider Example"&gt;&lt;/a&gt;
	
	&lt;h3&gt;View Slider Example&lt;/h3&gt;
	
	&lt;p&gt;If you want to skip the article and go straight to the final product view my &lt;a href="/tech/resources/45/"&gt;CSS Only JQuery Emulation Slider Demo&lt;/a&gt;.&lt;/p&gt;
	
	&lt;p class="b i"&gt;Note: you will need to use Safari in order to view the transition effect and I highly recommend that you do.&lt;/p&gt;
&lt;/div&gt;

&lt;h4&gt;My Goals Of This Proof Of Concept&lt;/h4&gt;

&lt;p&gt;My mission was to create a working example without the aid of JavaScript, using layers in CSS and using CSS3 transitions to give the slider the necessary animation.&lt;/p&gt;

&lt;h4&gt;HTML Structure&lt;/h4&gt;

&lt;p&gt;The HTML in it's most basic form consists of a container DIV and a simple unordered list. I also used P elements which could probably be removed depending on hardcore you want to be about extra elements. 
I did this because I needed to style the LIs differently than the text contained within the LIs such as floating, width etc.&lt;/p&gt;

&lt;code&gt;
&amp;lt;div id=&amp;quot;slider&amp;quot;&amp;gt;
  
	&amp;lt;ul&amp;gt;
		&amp;lt;li&amp;gt;
			&amp;lt;p&amp;gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&amp;lt;/p&amp;gt;
		&amp;lt;/li&amp;gt; 
		&amp;lt;li&amp;gt;
			&amp;lt;p&amp;gt;Sed ut est. Curabitur molestie. Cras pellentesque.&amp;lt;/p&amp;gt;
		&amp;lt;/li&amp;gt; 
		&amp;lt;li&amp;gt;
			&amp;lt;p&amp;gt;Maecenas consequat consequat lectus.&amp;lt;/p&amp;gt; 
		&amp;lt;/li&amp;gt; 
		&amp;lt;li&amp;gt;
			&amp;lt;p&amp;gt;In vel lorem quis turpis auctor volutpat.&amp;lt;/p&amp;gt;
		&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/code&gt;

&lt;p&gt;I use the following CSS to style the above elements.&lt;/p&gt;

&lt;code&gt;
#slider, ul, li { height: 300px; }
#slider, li { position: relative; width: 500px; }

#slider
{
margin: auto;
overflow: hidden;
padding: 10px;
}

li { float: left; }
&lt;/code&gt;

&lt;h4&gt;Positioning Our Slider&lt;/h4&gt;

&lt;p&gt;Next we need to set our UL which is the container of the slider's LIs. It needs a width set on it which is the &lt;b&gt;width of the LIs X the total number of LIs&lt;/b&gt;. If each LI were 500px wide and we had 4 LIs then the total width would be 2000px.
 I should note that you will also most likely have a margin between each of the LIs which this would need to be accounted for in the above.&lt;/p&gt;

&lt;code&gt;
ul
{
list-style-type: none;
position: absolute;
left: 0px;
top: 0px;
width: 2000px;
}
&lt;/code&gt;

&lt;p&gt;Next we move our UL element left baed on what LI we want to show in our slider. Look at the example below to see how I accomplish this. Each color block represents a LI. The block positioned over the black area represents the current visible LI.&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/45/slider-positions.png" alt="Slider Positions"&gt;&lt;/p&gt;


&lt;h4&gt;Adding Persistence To Our Slider With :Target&lt;/h4&gt;

&lt;p&gt;By far the most complicated part of this proof-of-concept is accomplishing all of this without the assistance of variables that JavaScript allows us to use. CSS variables are not yet a true reality (although one could argue that CSS Counters are a form 
of CSS Variables). To overcome this obstacle I used the CSS3 :target pseudo selector. The :target pseudo selector works with URL fragments like below:&lt;/p&gt;

&lt;code&gt;
&amp;lt;a href=&amp;quot;#page-anchor&amp;quot;&amp;gt;go to page anchor&amp;lt;/a&amp;gt;
&amp;lt;div id=&amp;quot;page-anchor&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
&lt;/code&gt;

&lt;p&gt;Using CSS we can actually style the page-anchor DIV if our page's URL contains #page-anchor like so: http://www.example.com/page.html#page-anchor.&lt;/p&gt;

&lt;code&gt;
#page-anchor:target { background: red; }
&lt;/code&gt;


&lt;h4&gt;Using :Target To Mimic Variables &amp;amp; Selectively Show Content&lt;/h4&gt;

&lt;p&gt;Since I do not have variables available to use I need to use the URL fragments to selectively show my LEFT and RIGHT arrows. If I didn't do this I wouldn't know which LI slide to move to next and I wouldn't know which slide LI I need to show. 
This would quickly defeat my ul { left: -500px } method. What I did was wrap my entire slider in 4 :target hooks which simulate variables:&lt;/p&gt;

&lt;code&gt;
&amp;lt;!-- :target hooks --&amp;gt;
&amp;lt;div id=&amp;quot;a1&amp;quot;&amp;gt;
&amp;lt;div id=&amp;quot;a2&amp;quot;&amp;gt;
&amp;lt;div id=&amp;quot;a3&amp;quot;&amp;gt;
&amp;lt;div id=&amp;quot;a4&amp;quot;&amp;gt;

&amp;lt;!-- 1 --&amp;gt;
&amp;lt;a href=&amp;quot;#a2&amp;quot; class=&amp;quot;up2 default&amp;quot;&amp;gt;2&amp;lt;/a&amp;gt;
&amp;lt;a href=&amp;quot;#a2&amp;quot; class=&amp;quot;up2&amp;quot;&amp;gt;2&amp;lt;/a&amp;gt;
  
&amp;lt;!-- 2 --&amp;gt;
&amp;lt;a href=&amp;quot;#a1&amp;quot; class=&amp;quot;down1&amp;quot;&amp;gt;1&amp;lt;/a&amp;gt;
&amp;lt;a href=&amp;quot;#a3&amp;quot; class=&amp;quot;up3&amp;quot;&amp;gt;3&amp;lt;/a&amp;gt;
  
&amp;lt;!-- 3 --&amp;gt;
&amp;lt;a href=&amp;quot;#a2&amp;quot; class=&amp;quot;down2&amp;quot;&amp;gt;2&amp;lt;/a&amp;gt;
&amp;lt;a href=&amp;quot;#a4&amp;quot; class=&amp;quot;up4&amp;quot;&amp;gt;4&amp;lt;/a&amp;gt;
  
&amp;lt;!-- 4 --&amp;gt;
&amp;lt;a href=&amp;quot;#a3&amp;quot; class=&amp;quot;down3&amp;quot;&amp;gt;3&amp;lt;/a&amp;gt;

&amp;lt;/div&amp;gt; &amp;lt;!-- End #a4 --&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- End #a3 --&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- End #a2 --&amp;gt;
&amp;lt;/div&amp;gt; &amp;lt;!-- End #a1 --&amp;gt;
&lt;/code&gt;

&lt;h4&gt;Using Our :Target Hooks To Postion Our UL&lt;/h4&gt;

&lt;p&gt;I then use the following CSS to move our UL left 0px, -500px etc.&lt;/p&gt;

&lt;code&gt;
#a1:target ul { left: 0px; }
#a2:target ul { left: -500px; }
#a3:target ul { left: -1000px; }
#a4:target ul { left: -1500px; }
&lt;/code&gt;


&lt;p&gt;I next use these same hooks to hide/show the appropriate LEFT/RIGHT arrows:&lt;/p&gt;

&lt;code&gt;
#a1:target .up2,
#a2:target .down1,
#a2:target .up3,
#a3:target .down2,
#a3:target .up4,
#a4:target .down3
{ display: block; }
&lt;/code&gt;


&lt;h4&gt;Giving Our Slider Animation&lt;/h4&gt;

&lt;p&gt;If you were to test out the demo up to this point you would notice that when you click the LEFT/RIGHT arrows, it would automatically switch to the next slide rather abruptly. To fully achieve our JQuery-like slider we need to use 
&lt;a href="http://webkit.org/blog/138/css-animation/"&gt;CSS3 Transitions&lt;/a&gt; which was originally proposed by the Webkit team and has since been adopted into canon by the W3C. What this means is, at the moment the animations will only work in Safari, 
but Opera and Firefox will not be far behind to implement this exciting new CSS feature.&lt;/p&gt;

&lt;p&gt;To achieve the CSS animation we need to first define what CSS property we want to animate. We can do this by stating '-webkit-transition: left'. 
Next we state the amount of milliseconds we would like the transition to occur over by adding '.3s'. Finally  we add linear to the end stating that it is a linear transition. Here is the fully property statement:&lt;/p&gt;

&lt;code&gt;
ul { -webkit-transition: left .3s linear; }
&lt;/code&gt;

&lt;h4&gt;Demo&lt;/h4&gt;

&lt;p&gt;To view the final product (which I recommend you use Safari which supports CSS Transitions) view my &lt;b&gt;&lt;a href="/tech/resources/45/"&gt;CSS Only JQuery Slider Emulation Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Before you comment stating why on earth anybody would ever use this when it can be accomplished so much easier in JavaScript please remember this is just a proof of concept and a test to see if it could be done using only CSS.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=45"&gt;View Comments [6]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/E-fuuRUcPBQ" height="1" width="1"/&gt;</description>
<pubDate>Wed, 22 Apr 2009 22:09:43 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=45</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>css3</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=45</feedburner:origLink></item>
<item>
<title>My Proposed CSS Property: Intended-Brightness</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/vkN5q4QxqCM/thread.php</link>
<description>&lt;p&gt;Have you ever created a really great looking website design, ideally on a color-corrected LCD monitor only to find it looks terrible on another user's monitor?
 I've noticed several times, designs I have created look extremely washed-out on some of my co-workers factory default, cheap, LCD monitors. Sometimes the users have
 their brightness/contrast/gamma turned up so high that hex colors such as #ececec or #dddddd look almost the same as #ffffff (white). So what could be done to fix this?&lt;/p&gt;

&lt;h4&gt;Overlay A DIV?&lt;/h4&gt;
 
&lt;p&gt;Originally I thought it could be possible to overlay a DIV, with opacity, over the entire viewport in a futile attempt to make the screen 'darker'. This was futile because the DIV
 essentially makes it impossible to click anything underneath it.&lt;/p&gt;
 
&lt;h4&gt;A New CSS Property&lt;/h4&gt;

&lt;p&gt;After giving it some thought, I came to the conclusion that we need a new CSS property which I've decided to call 'intended-brightness'. The syntax might look something like this:&lt;/p&gt;

&lt;code&gt;
html
{
intended-brightness: 0.5;
}
&lt;/code&gt;

&lt;p&gt;Intended-Brightness would take a decimal that could range from 0.0 to 1.0 (much like opacity does). This would allow the designer of the website to design using their native brightness 
and then ensure that the website looks the same on all monitors rather than dark on some and washed-out on others.&lt;/p&gt;

&lt;h4&gt;Accessibility?&lt;/h4&gt;

&lt;p&gt;Obviously accessibility proponents would complain about this new property because some users (heaven forbid) would want their browser's brightness cranked up to 95%. Because of this, browser vendors 
could create an option like they do for other CSS properties related to browser accessibility such as font-size, color, background-color etc. See below for Firefox's tab regarding these settings:&lt;/p&gt;

&lt;p&gt;&lt;img src="/tech/resources/44/browser-options.png" alt="Firefox's default styling options"&gt;&lt;/p&gt;

&lt;h4&gt;CSS Inheritance?&lt;/h4&gt;

&lt;p&gt;One issue I'm not sure on yet is whether the property could be inherited by child elements. The property could act like the various 'background' properties where the background-image 
is only set on the current element and not the child elements. The property could also allow inheritance basically allowing child elements to have a different brightness than other elements.&lt;/p&gt;

&lt;p&gt;Personally, I think it would be easier, and faster to implement using the non-inheritanced method which is usually the desired effect web developers would want.&lt;/p&gt;

&lt;h4&gt;Does This Belong In CSS?&lt;/h4&gt;

&lt;p&gt;Of course! CSS already allows the styling of many other features native to the operating system such as form controls, scrollbars, cursors and text-selection colors. Another very similar property 
already present in CSS is opacity which I think further strengthens my case.&lt;/p&gt;

&lt;p&gt;So what do you think? Feel free to discuss below -&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=44"&gt;View Comments [7]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/vkN5q4QxqCM" height="1" width="1"/&gt;</description>
<pubDate>Tue, 14 Apr 2009 18:41:24 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=44</guid>
<author>Neal Grosskopf</author>
<category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=44</feedburner:origLink></item>
<item>
<title>Browser Comparision of Available Screen Width When Using 1024x768</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/nPqfZuBoD0g/thread.php</link>
<description>&lt;div style="float: right; width: 275px; margin: 0px 0px 20px 20px;" class="image-caption"&gt;
	&lt;img src="/tech/resources/43/facebook-scrollbars.png" alt="Horizontal Scrollbars on Facebook"&gt;
	&lt;h3&gt;Figure A.&lt;/h3&gt;
	&lt;p&gt;Facebook's horizontal scrollbars showing up on a 1024x768 screen resolution. &lt;i&gt;(Note this screenshot was took on my own PC using Firefox)&lt;/i&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;I was using my parent's computer the other day which is your standard Dell with a LCD monitor set at 1024x768. I decided to log on to Facebook, one of the internet's most popular websites. Upon logging in, 
using Internet Explorer 7, I was greeted with a wonderful horizontal scrollbar. I thought to myself "Facebook, the world's leading social network has horizontal scrollbars?". Sure enough, the Facebook developers failed to check their re-designed 
website in IE7, or possibly, on a 1024x768 monitor.&lt;/p&gt;

&lt;p&gt;I wouldn't have minded if a horizontal scrollbar appeared if the design was targeted towards a higher resolution such as 1280x960 but this looked more like blatant oversight on
Facebook's part. Look at how little of a horizontal scrollbar appears - &lt;b&gt;Figure A.&lt;/b&gt;&lt;/p&gt;

&lt;h4&gt;Unnecessary Horizontal Scrollbars = Evil&lt;/h4&gt;

&lt;p&gt;Nobody likes horizontal scrollbars (unless of course &lt;a href="http://www.cssleak.com/Category/Horizontal-Scrolling-Websites.html"&gt;your entire design relies on it&lt;/a&gt;). Horizontal scrollbars are 
annoying because they hide 15-17px of content at the bottom of you page. They are also confusing because the web browser is typically browsed un-directionally, due to limitations of the mouse's 
scroll wheel. When a user has to scroll down and over, this forces the user to abandon the mouse wheel and manipulate the horizontal scroll bar with the mouse's left button, thus wasting time.&lt;/p&gt;

&lt;h4&gt;So What Is The Available Screen Width In Various Browsers?&lt;/h4&gt;

&lt;p&gt;Had Facebook done their homework they would have realized that a content width of 1024px combined with a vertical scrollbar results in a horizontal scrollbar. Below is the maximum 
width you can use in various browser viewports, showing both with a vertical scrollbar and without:&lt;/p&gt;

&lt;table class="data"&gt;
&lt;caption&gt;Viewport Maximum Width in Pixels&lt;/caption&gt;
&lt;tr class="def"&gt;
	&lt;th&gt;&amp;nbsp;&lt;/th&gt;
	&lt;th&gt;Without Vertical Scrollbar&lt;/th&gt;
	&lt;th&gt;With Vertical Scrollbar&lt;/th&gt;
	&lt;th&gt;Scrollbar Width&lt;/th&gt;
&lt;/tr&gt;
&lt;tr class="alt"&gt;
	&lt;td&gt;Safari 3&lt;/td&gt;
	&lt;td&gt;1024&lt;/td&gt;
	&lt;td&gt;1009&lt;/td&gt;
	&lt;td&gt;15&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="def"&gt;
	&lt;td&gt;Firefox 3&lt;/td&gt;
	&lt;td&gt;1024&lt;/td&gt;
	&lt;td&gt;1007&lt;/td&gt;
	&lt;td&gt;17&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="alt"&gt;
	&lt;td&gt;Chrome 2 &lt;/td&gt;
	&lt;td&gt;1024&lt;/td&gt;
	&lt;td&gt;1007&lt;/td&gt;
	&lt;td&gt;17&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="def"&gt;
	&lt;td&gt;Opera 9&lt;/td&gt;
	&lt;td&gt;1023&lt;/td&gt;
	&lt;td&gt;1006&lt;/td&gt;
	&lt;td&gt;17&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="alt"&gt;
	&lt;td&gt;Internet Explorer 7&lt;/td&gt;
	&lt;td&gt;1003&lt;/td&gt;
	&lt;td&gt;1003&lt;/td&gt;
	&lt;td&gt;17&lt;span class="sup"&gt;[1]&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class="def"&gt;
	&lt;td&gt;Internet Explorer 6&lt;/td&gt;
	&lt;td&gt;1003&lt;/td&gt;
	&lt;td&gt;1003&lt;/td&gt;
	&lt;td&gt;17&lt;span class="sup"&gt;[1]&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;&lt;i&gt;&lt;span class="sup"&gt;[1]&lt;/span&gt;IE incorrectly includes the scrollbar width in the element's width, thus the actual scrollbar width is 0px.&lt;/i&gt;&lt;/p&gt;

&lt;h4&gt;So What's My Point?&lt;/h4&gt;

&lt;p&gt;By looking at the chart above, we need to pick the lowest value as our maximum width. Seeing that 1003 is the lowest, which is used in Internet Explorer 6 &amp;amp; 7, if you plan to create a design 
for 1024x768, I would advise that you not make it wider than 1003 pixels. I would also advise that you never make your main content DIV an odd width. See 
&lt;a href="http://csscreator.com/node/472#comment-2208"&gt;http://csscreator.com/node/472#comment-2208&lt;/a&gt; for more on that. My point is, you're better off choosing a width less than 1000px if you want to avoid horizontal scrollbars. 
&lt;b&gt;Remember to always check you design in the early stages of development for your baseline screen resolution.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;You might also be interested in my article &lt;a href="/tech/thread.asp?pid=12"&gt;Always Show Browser Scrollbars&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=43"&gt;View Comments [8]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/nPqfZuBoD0g" height="1" width="1"/&gt;</description>
<pubDate>Tue, 07 Apr 2009 21:26:18 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=43</guid>
<author>Neal Grosskopf</author>

<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=43</feedburner:origLink></item>
<item>
<title>Organize Your Stylesheet Madness &amp; Reduce It's File Size With These Tips</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/B1lqT8EW7lQ/thread.php</link>
<description>&lt;p&gt;The other day at work, I had some spare time so I decided to take a look at one of our stylesheets from one of our older websites. The stylesheet was currently over 700 lines long, which I don't consider that long and stood at about 13kb, which again I don't find particularly large.&lt;/p&gt;

&lt;h4&gt;Shredding The Extra File Size&lt;/h4&gt;

&lt;p&gt;After reviewing the CSS file I noticed it lacked organization, and probably the worst of all, it repeated itself...a lot! My top pet peve with stylesheets is when properties are copied 
from one selector to another. Below is one example of what I'm talking about:&lt;/p&gt;

&lt;code&gt;
a.ProdNav:link
{
color: #666666; 
font-size: 11px; 
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
text-decoration: underline;
padding-left: 15px;
padding-right: 15px;
}

a.ProdNav:visited
{ 
color: #666666; 
font-size: 11px; 
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
text-decoration: underline;
padding-left: 15px;
padding-right: 15px;
}

a.ProdNav:hover
{ 
color: #333333; 
font-size: 11px; 
font-family: Arial, Helvetica, sans-serif;
font-weight: 600;
text-decoration: underline;
padding-left: 15px;
padding-right: 15px;
}
&lt;/code&gt;

&lt;p&gt;Notice the &lt;i&gt;Golden Rule&lt;/i&gt; in programming which is "don't repeat yourself" is broken here? If you look close enough, the only thing that changes from the three link states is the font color.
 Let's shorten that up a bit to see what it could look like:&lt;/p&gt;
 
&lt;code&gt;
a.ProdNav, a.ProdNav:visited
{
color: #666666;
font-weight: 600;
padding: 0px 15px;
text-decoration: underline;
}
a.ProdNav:hover { color: #333333; }
&lt;/code&gt;

&lt;p&gt;Ah yes, much better. A full 24 lines shorter and much easier to follow. (Note I also removed some font styling as it was better served on the BODY element). Little things like this can make your stylesheet better organized and also much smaller. 
After removing mistakes like this from the stylesheet, I was able to remove over 200+ lines from it and shred 5KB file in file size.&lt;/p&gt;

&lt;h4&gt;Overall Stylesheet Organization &amp; Grouping&lt;/h4&gt;

&lt;p&gt;Another area to pay attention to is how you organize your selectors within your stylesheet. Too often, I review other people's CSS files and have no idea where to find something. The first thing you 
should &lt;b&gt;always&lt;/b&gt; do is group like-selectors with one another. Below is how I usually choose to organize my stylesheets:&lt;/p&gt;

&lt;ol style="list-style-type: upper-roman;"&gt;
	&lt;li&gt;Table Of Contents&lt;/li&gt;
	&lt;li&gt;CSS Variables&lt;/li&gt;
	&lt;li&gt;CSS Image Preload&lt;/li&gt;
&lt;/ol&gt;
&lt;ol&gt;
	&lt;li&gt;Reset&lt;/li&gt;
	&lt;li&gt;Headings&lt;/li&gt;
	&lt;li&gt;Anchors&lt;/li&gt;
	&lt;li&gt;Form Elements&lt;/li&gt;
	&lt;li&gt;General Classes&lt;/li&gt;
	&lt;li&gt;Template &amp; Layout&lt;/li&gt;
	&lt;li&gt;Print&lt;/li&gt;
	&lt;li&gt;Handheld&lt;/li&gt;
	&lt;li&gt;Aural&lt;/li&gt;
	&lt;li&gt;CSS Diagnostics&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;CSS Table of Contents&lt;/h4&gt;

&lt;p&gt;I recommend a table of contents for stylesheets over 500 lines long, which in most cases, is always my CSS files. I also recommend that you separate your groups of selectors with CSS comments. Numbering them
with the same number you used in your table of contents will make finding the area quicker as well. Below is how I prefer to do this as it makes it stand out more. I also like to place code references in the heading in case I need to quickly refer back.&lt;/p&gt;

&lt;code&gt;
/****************************************************************
 1. Reset  -  http://meyerweb.com/eric/tools/css/reset/
****************************************************************/
&lt;/code&gt;

&lt;h4&gt;CSS Variables?&lt;/h4&gt;

&lt;p&gt;You may have noticed my reference to &lt;a href="http://disruptive-innovations.com/zoo/cssvariables/"&gt;CSS Variables&lt;/a&gt; and are wondering what the heck this is. It's currently a proposal for CSS, which may never happen but after
the W3C recently adopting CSS Transformations, I think CSS Variables still stands a chance. While you don't need to adhere to the spec, I sometimes like to place common color references at the top of my stylesheet for quick reference:&lt;/p&gt;

&lt;code&gt;
/****************************************************************
 II. CSS Variables - Spec: http://disruptive-innovations.com/zoo/cssvariables/
****************************************************************/
/*
@variables {
Text: #555555;

DarkGreen: #669933;

DarkLimeGreen: #7e935a;
MediumLimeGreen: #949f74;
LimeGreen: #adb986;
LightLimeGreen: #ccdb9f;

DarkBrown: #a7917b;
LightBrown: #b69f86;
}
*/
&lt;/code&gt;

&lt;h4&gt;Preloading Images In CSS&lt;/h4&gt;

&lt;p&gt;I also have a section where I preload :hover state images to be consumed further along in my stylesheet. I've written an article on &lt;a href="/tech/thread.asp?pid=24"&gt;CSS image preloading&lt;/a&gt; if you want
to read more on this topic. By doing this I avoid the one second flicker that many users experience when hovering over an element with a background image. I like to group these together because I find they can often get lost 
in the overall stylesheet and eventually somebody else will run across the selector, not understand it's purpose and delete it.&lt;/p&gt;

&lt;code&gt;
/****************************************************************
 III. CSS Image Preload - http://www.nealgrosskopf.com/tech/thread.asp?pid=24
****************************************************************/
#nav { background: url(/files/images/template/menu_bg-trans.png) no-repeat -9999px -9999px; }
#header { background: url(/files/images/template/helper_sub_bg-trans.png) no-repeat -9999px -9999px; }
#container { background: url(/images/icons/actions/actions_sprite.png) no-repeat -9999px -9999px; }
&lt;/code&gt;

&lt;h4&gt;Other Common Sections in CSS Files&lt;/h4&gt;

&lt;p&gt;I like to place my CSS reset at the top of the stylesheet so that I can override it further down if need be. I also have a section for heading elements i.e. H1, H2, H3, site-wide anchors, form elements and
also general classes such as .b .u .i .left .right for bold, underline, italic, text-align: left &amp; text-align: right etc. I also include in here styling for blockquotes, images and some other common
non-structure styling.&lt;/p&gt;

&lt;p&gt;After that I like to have a grouping for "Template &amp; Layout". Under this heading I like to place structural styling such as DIV sizes and positions. I will also throw in here some font formatting if 
it's specific to that particular DIV. I know some people like to break out the font styling into their own section or even stylesheet (god why does it need it's own stylesheet?)&lt;/p&gt;

&lt;p&gt;After that, if I'm feeling ambitious, I'll create sections for @print, @handheld and @aural. I have some stock CSS I use for @print so that usually leaves @handheld and @aural to do for later.&lt;/p&gt;

&lt;h4&gt;And Don't Forget...CSS Diagnostics!&lt;/h4&gt;

&lt;p&gt;Last but not least, I have my &lt;a href="/tech/thread.asp?pid=17"&gt;Diagnostic Styling&lt;/a&gt;. I've written an article about this already so feel free to check that out, but in a nutshell &lt;a href="/tech/thread.asp?pid=17"&gt;CSS Diagnostics&lt;/a&gt;
is CSS that highlights ugly areas of your HTML so that you can quickly fix them. The reason this goes at the end of the stylesheet is that it needs to 'trump' all other selectors that have been set
so far.&lt;/p&gt;

&lt;h4&gt;Organize Your CSS Properties...Please!&lt;/h4&gt;

&lt;p&gt;Finally the last thing I like to do when cleaning up/developing a stylesheet is alphabetical organizing my CSS properties. Below is a selector with a whole slew of properties which are unorganized:&lt;/p&gt;

&lt;code&gt;
.pageIDnest
{
Position: relative;
width: 400px;
height: 15px;
margin-left: 10px;
margin-top: 25px;
line-height: 20px;
color: #ef3e41; 
font-size: 12px; 
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: 700;
text-decoration: none;
border-bottom-color:#cccccc;
border-bottom-style: solid;
border-bottom-width: 1px;
padding-left: 10px;
}
&lt;/code&gt;

&lt;p&gt;Now let's sort it and use some CSS shorthand (which I'll explain shortly).&lt;/p&gt;

&lt;code&gt;
.pageIDnest
{
border-bottom: 1px solid #cccccc;
color: #ef3e41; 
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px; 
font-weight: 700;
height: 15px;
line-height: 20px;
width: 400px;
margin: 25px 0px 0px 10px;
padding-left: 10px;
position: relative;
text-decoration: none;
&lt;/code&gt;

&lt;p&gt;Looks better, doesn't it? You'll notice one property that isn't sorted alphabetically. Did you find it? Width, yes I didn't place width at the end. I do have two exceptions with sorting my properties.
The first one is width &amp; height. The second is position + top,right,bottom,left. I like to group these two sets of properties together since they all have a relationship to one another and I find
myself editing them at the same. You'll also notice that I did not use CSS shorthand for my font properties. I generally avoid using shorthand for the font set of properties as it can be a bit tricky to correctly implement since several of the 
properties share the same values and also need to be the correct order.&lt;/p&gt;

&lt;h4&gt;CSS Shorthand&lt;/h4&gt;

&lt;p&gt;Finally, use &lt;a href="http://www.dustindiaz.com/css-shorthand/"&gt;shorthand CSS&lt;/a&gt; whenever possible. It will save you lines of code to sift through and also KB of file size. A few property groups you can use it on are:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Background&lt;/li&gt;
	&lt;li&gt;Border&lt;/li&gt;
	&lt;li&gt;Font-Family&lt;/li&gt;
	&lt;li&gt;List-Style&lt;/li&gt;
	&lt;li&gt;Margin&lt;/li&gt;
	&lt;li&gt;Outline&lt;/li&gt;
	&lt;li&gt;Padding&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Conclusions&lt;/h4&gt;

&lt;p&gt;Your CSS file doesn't need to be an afterthought after you finished programming your website and adding the markup. It can shine, just like your carefully crafted server-side code does. 
By organizing, grouping, documenting and shortening your CSS file your co-workers will thank you and you will know that you did a good job at the end of the day.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Have any secrets to your CSS organizational success? Share them below - &lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=42"&gt;View Comments [4]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/B1lqT8EW7lQ" height="1" width="1"/&gt;</description>
<pubDate>Tue, 31 Mar 2009 21:40:13 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=42</guid>
<author>Neal Grosskopf</author>
<category>css</category><category>organization</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=42</feedburner:origLink></item>
<item>
<title>CSS Drop Caps Without Unnecessary HTML Elements or Classes</title>
<link>http://feedproxy.google.com/~r/ng-tech/~3/t5mfLzJsB0A/thread.php</link>
<description>&lt;p&gt;Drop capitals are commonly seen in newspapers or books. They can be identified by looking at the first letter of a paragraph or a page that is usually larger than the rest of the paragraph, bolded and often
times a different font-family.&lt;/p&gt;

&lt;p&gt;I've seen many different methods to achieve this effect in HTML and CSS, most of the time the method requires unnecessary elements or classes. I'll give an example of how to do drop caps in CSS without any
classes, and then I'll show you a second method which will require you to place a single class on the parent element.&lt;/p&gt;

&lt;h4&gt;Styling Our Drop Cap in CSS Without Classes&lt;/h4&gt;

&lt;p&gt;The first option is if you want to style the first P element on every page of your website with a drop cap. The selector below will first use the :first-child pseudo selector to find our first P element
and then it will select the first letter of the P element with the first-letter pseudo selector.&lt;/p&gt;

&lt;p&gt;I've added some other visual effects to our drop cap such as a background-color, font-family, text-transform, and a double'd border which is seldom used.&lt;/p&gt;

&lt;code&gt;
body p:first-child:first-letter
{
background: #990000;
border: 4px double #ffcc00;
color: #ffffff;
float: left;
font-family: "Times New Roman", Times, serif;
font-size: 3em;
font-weight: bold;
margin: 7px 10px 0px 0px;
padding: 10px;
text-transform: uppercase;
}
&lt;/code&gt;

&lt;p&gt;&lt;b&gt;&lt;a href="/tech/resources/41/"&gt;View Demo &amp;gt;&amp;gt;&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;

&lt;h4&gt;Using A Class&lt;/h4&gt;

&lt;p&gt;You may also want to selectively apply a drop cap to other blocks of text on your website. In this case, simply add a class to the paragraph and add this selector to your CSS:&lt;/p&gt;

&lt;code&gt;
.dropcap
{
...
}
&lt;/code&gt;&lt;p&gt;&lt;a href="http://www.nealgrosskopf.com/tech/thread.php?pid=41"&gt;View Comments [0]&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/ng-tech/~4/t5mfLzJsB0A" height="1" width="1"/&gt;</description>
<pubDate>Wed, 25 Mar 2009 18:41:09 -0500</pubDate>
<guid isPermaLink="false">http://www.nealgrosskopf.com/tech/thread.php?pid=41</guid>
<author>Neal Grosskopf</author>
<category>css</category>
<feedburner:origLink>http://www.nealgrosskopf.com/tech/thread.php?pid=41</feedburner:origLink></item>
</channel>
</rss>
