Mar 3 2010

Speed Up with CSS3 Gradients

WebKit browsers paved the way with CSS based gradients. Now Firefox 3.6 is out and is supporting them as well, which makes using them for progressive enhancement all the more appealing. More good news, CSS3 gradients fall into the camp where you can specify fallbacks (i.e. images) so that browsers that don’t support them just use the image instead.

But wait… if you need to use an image anyway, why bother with declaring the gradient with CSS? That is kind of how I felt for a long time, but there is one important aspect that makes it worth it: browsers that support them don’t load the image fallback. One less HTTP Request = all the faster your site will load.

Huge thanks to Patrik Spathon for this idea and help with the demo page!

How it’s done

Cutting to the chase, here is how it’s done:

div {
            background-color: #1a82f7; /* fallback color */
            background-image: url(images/linear_bg_2.png); /* fallback image */
            background-image: -moz-linear-gradient(100% 100% 90deg, #2F2727, #1a82f7);
            background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1a82f7), to(#2F2727));
}

View Demo   Download Files

Different syntax for different rendering engines

Mozilla (Firefox, Flock, etc)

Mozilla’s syntax (more detail here) is like this:

-moz-linear-gradient( [<point> || <angle>,]? <stop>, <stop> [, <stop>]* )

The simplest way to declare a gradient is to just list a comma separated list of colors. That will start at the top and gradient to the bottom with equidistant color stops for each color. In the demo code above, we use a point and an angle (90deg) to it go bottom-to-top instead. For radial gradients: -moz-radial-gradient

WebKit (Safari, Chrome, etc)

WebKit’s syntax (more detail here) is like this:

-webkit-gradient(<type>, <point> [, <radius>]?, <point> [, <radius>]? [, <stop>]*)

Trident (IE)

Trident’s syntax (not really CSS3… more detail here) is like this:

filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB);

-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB)";

Unfortunately, we can’t invite IE to the party! Using these filter properties does indeed work, and it would allow us to programatically declare gradients which is cool. But, instead of using the filter first and the image as a fallback, declaring a background-image overrides the filter and it uses that. Since we definitely still need image fallbacks, we might as well not use this at all.

“Stops”

The WebKit and Mozilla syntax for gradients both incorporate “stops”. A stop is an optional additional declaration that includes a point and a color. This means the gradient wont just start at one color and end at the other, it will fade to the stop color first, and that stop color will fade to the end color. More than one stop can also be used.

Saving HTTP requests

Using Firebug and looking in the Net tab to see all the resources used by the page, we can see the advantage.


The above screenshot is Firefox 3.6. We can see that the gradient fallback images are NOT loaded, which saves an HTTP request.

However using Firefox 3.5.8, the fallbacks are loaded.


We don’t save any HTTP Requests in olders version of Firefox (This is 3.5.8 on Vista). The gradient fallback images are still being loaded (and used).

It gets a little more iffy in WebKit browsers.


WebKit browsers WILL use the CSS3 property to render the gradient, but at the same time, still load the fallback images, so no HTTP requests are saved. The only advantage is the programatic declaration of color.

Doing it by the numbers

The speed gained by losing an HTTP request, to me, is the biggest advantage. The more I learn about web performance it seems to me keeping those down is the #1 way to improve page load time. However there is another advantage to using CSS3 gradients, and that is that these gradients are created programatically through numbers. Need to adjust some colors? Just adjust some numbers. No need to bring a big image editing program into the picture. This makes maintaining the site easier, as well as opens up doors for adjusting values on-the-fly. I imagine JavaScript libraries will begin to get the ability to animate these values soon enough, which will be pretty darn cool.

Ooooh Stretchy

When using an image for a gradient, it is declared as a CSS background-image and then repeated (you can often get away with a 1px slice, which is very efficient, size wise). The result though is that a static portion of the background is gradientized, and any overflow to that is flat color. Sometimes that works perfectly. Sometimes though it would be cool if the gradient stretched the entire height or width of the box. That is another thing CSS3 gradients can possibly be useful for:

So the big question is…

Is it really worth doing right now? I’m thinking it’s pretty darn close. If the numeric representation is a big deal to you, then I say yes you should start using them. If the speed is the only reason you would, then just realize that the only browser that it will help in is Firefox 3.6+, so you might wanna wait a bit on that.


Mar 3 2010

Digging Into WordPress, v2 Back in Print

We sold out of our first batch of Digging Into WordPress books in a matter of weeks. We could have just ordered more as soon as supplies were low, but it just so happened that right about that time WordPress 2.9 was out, which has many new features. We were already working on revising the book, so we figured instead of reprint books that were 2.8.6 based, we would wait to finish all the 2.9.2 stuff and reprint the book with all that. So that’s what we did!

Today, the print version of the book is back for sale. The book features some revised content, and two new chapters! The all-new Chapter 10 is called “Bonus Tricks” where we detail out some cool things you can add to themes. In this chapter we also introduce the two brand new themes that now come included with the book! Chapter 11 is called “WordPress Updates”, where we include what is new in 2.9.2, how to use those new features, and where we will continue to expand when new versions come out.

If you have already bought the book, you should already have gotten an email with a download link for the new version, which also contains the new bundled themes.

Not only that, but the site is sporting a fresh new design!

Bundled Themes

The best way to illustrate and explain something is often just to give someone the finished product and let them explore it. There is lots of code in the book, but it’s all removed from the context of a real design. Now you’ll get some real themes along with the book so you can see how that code is used in an actual theme. The themes do a particularly good job illustrating two big topics:

  • Theme Options Panel – Both themes have options panels for setting various theme-specific options. They are built in a “framework” style, so that adding your own or adjusting what options are there is pretty easy.
  • Child Themes – Both themes come with a child theme which restyles the theme without affecting any of how it works. If you’ve always wondered how that works, you can see it with these themes.

Plastique

See theme options shine here as there is a ton of options to control your theme. Everything from how it is laid out (columns, positions) to what types of things you wish to include, to adding in markup into individual sections. Preview Theme

Lines & Boxes

Based on the look of a wireframe, Lines & Boxes could be used as-is for a minimalist look, or used as a starting point for a more fleshed out graphical theme. Some theme options including overriding the header of the site, and options on if you want the main navigation to be a category list or a page list. Preview Theme

All AJAX

“All Ajax”, also a bundled theme, is based off Lines & Boxes but is not technically a child theme. The idea is that every internal link on the site loads without page refresh. Preview Theme

Get it

Even with all the new themes and 30+ new pages, the price point for the book and PDF stay the same. $27 for the PDF and $67 + S&H for the Book/PDF Combo. If you buy the print book, remember that automatically comes with the PDF which now comes as a bundle with the themes, so you don’t miss out on that action.

What happens if you bought the PDF while the book was sold out and now want the print copy? That would be anytime between January 18th and February 28th. If that describes your situation, just forward a copy of your receipt to sales@digwp.com and ask us for a discount code. We’ll send you one you can use on the print copy good for the value of what you paid for the PDF.

Go get it


Mar 3 2010

Beyond Keywords: Increase Your Google AdSense Revenue

This two-part article series explains how to maximize your revenue from Google AdSense. You should have read the first part already as it discusses the selection of keywords for AdSense success. This time we ll go beyond analyzing keyword-related issues and suggest other ways to increase Google AdSense revenue….

GoGrid Cloud Center Connect Cloud and Dedicated Servers on Your Private Data Center


Mar 3 2010

Yahsat تحصل على الرخصة الثالثة لتشغيل خدمات الإتصالات في الإمارات

yahsatlogo

حصلت شركة الياه للإتصالات الفضائية “ياه سات” على الرخصة الثالثة التي تمنحها سلطة تنظيم الإتصالات الإماراتية لتصبح بذلك هي المشغل الثالث المصرح له بتقديم خدمات الإتصالات الصوتية, نقل البيانات و خدمات الإنترنت و التليفزيون الرقمي في الإمارات إضافة الى “دو” و “إتصالات”. ياه سات هي شركة متخصصة في خدمات الإتصالات عبر الأقمار الصناعية و ينتظر أن تقدم بعد حصولها على هذا الترخيص و الذي يمتد لمدة 10 سنوات مجموعة متكاملة من خدمات الإتصالات و البيانات و الإنترنت و التليفزيون الرقمي عالي التحديد تعتمد على الإتصال عبر الأقمار الصناعية. الشركة أعلنت بعد حصولها على هذا الترخيص بأنها بصدد إطلاق قمرين صناعيين لدعم خدماتها خلال العام المقبل 2011. لا تتوافر لدينا أي معلومات إضافية في الوقت الحالي تتعلق بالشكل التجاري النهائي للخدمات التي ستقدمها الشركة و إذا ما كانت تنوي تقديمها في صورة باقات تجمع بين جميع هذة الخدمات معا – و هي الفكرة التي تبدو لنا جيدة جدا – أم في صورة خدمات مستقلة.

Digg
del.icio.us
Facebook
Google
BlinkList
LinkedIn
MySpace
StumbleUpon
Technorati
YahooMyWeb
Reddit
TwitThis



Mar 3 2010

مجموعة من هواتف Windows Phone 7 Series تصدر في موسم عطلات 2010 و جميعها بمعالجات Qualcomm Snapdragon

windows-phone-7-series-apps

إعتدنا أن نحاول البحث عما وراء الأنباء و أن ننظر لها بزاوية مختلفة لاستخلاص معلومات جديدة ربما تفقدها عند النظرة الأولى, شركة Qualcomm المتخصصة في إنتاج المعالجات و الشرائح الإلكترونية الخاصة بالهواتف المحمولة و الأجهزة المتنقلة أفادتنا في بيان صحفي صدر عنها بالأمس أنها – ونحن هنا نقتبس نص كلماتهم – “ستصبح أول مُنتج للمعالجات الداعمة للإطلاق التجاري للهواتف المرتكزة إلى نظام ويندوز فون السلسلة 7 (Windows® Phone 7 Series)  من شركة مايكروسوفت” و ذلك عبر المعالج Snapdragon الخاص بها. قد تكون هذة خلاصة ما أرادت Qualcomm أن تقوله و لكن بنظرة أكثر دقة الى الأمر يمكننا أن نخرج بمجموعة من الإستنتاجات أو التساؤلات أو أيا ما تكون هذة الخواطر.

الحقيقة الأولى: هناك أكثر من جهاز تجاري مكتمل البناء سيحمل نظام التشغيل Windows Phone 7 Series و ستحمل هذة الأجهزة جميعها المعالج Snapdragon الذي يعد من بين أسرع معالجات الهواتف المحمولة المتوفرة حاليا و ستصدر هذة الأجهزة بشكل مجتمع بحلول “موسم عطلات 2010″. أما التساؤلات فهي, هل وضعت ميكروسوفت حدا أدنى من المواصفات اللازمة لتشغيل نظام تشغيلها الجديد ما يجعل المعالج Snapdragon هو الوحيد في الوقت الحالي الذي يزود هذا القدر المطلوب من المواصفات الفنية الداخلية اللازمة لهذة الهواتف الجديدة ؟؟ أظن أن هذا التساؤل يحمل مصداقية كبيرة بالنظر الى قيمة هذا التصريح من Qualcomm. أما التساؤل الآخر الذي يطرح نفسه فهو هل هناك شركات أخرى قد تدخل الى الساحة بمعالجات للهواتف المحمولة بهذة السرعات العالية ؟؟ و هل تنوي Qualcomm بما استشعرناه من سياق الحديث دعم هذا النظام بجيل جديد من المعالجات ربما بسرعات تتخطى ما قدمته مع Snapdragon, ثنائية النواة ربما في وقت لاحق ؟؟

Digg
del.icio.us
Facebook
Google
BlinkList
LinkedIn
MySpace
StumbleUpon
Technorati
YahooMyWeb
Reddit
TwitThis