spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / authoring / style / sheets / multiclass current pageTo page 2To page 3
[next]

Saving Bytes by Using Multiple CSS Classes on Elements

Developer News
Metasploit 3.2 Offers More 'Evil Deeds'
'Thank You Apple. Seriously.'
The Buzz: BlackBerry App Store Seen Next

By Eddie Traversa (etraversa@dhtmlnirvana.com)

Debates around the use of W3C Web standards by developer's/designers often focus around the pros and cons of using standards on Web pages. Typically, this debate is performed at an intellectual level, rather than providing a clear and concise method that consistently demonstrates the benefits of using W3C standards. It is one thing to argue the benefits of Web standards, quite another to clearly demonstrate why Web standards can benefit us all.

From my limited perspective, we are on the brink of new era in the development and design of Web pages, simply because the landscape we typically cater to has changed considerably in the past year. For one thing we see that Netscape 4's market share has dropped considerably down to around the 2% mark. Internet Explorer 4 also suffers a similar fate (http://www.thecounter.com/stats/2002/November/browser.php).

Combine this decline with the advent of the newer generation browsers such as Internet Explorer 6, Netscape 7 and Opera 7 and it is not difficult to see that the Web world is primed to take advantage of standards based approaches to building Web pages. All that remains to do is provide some clear practical educational material to make the process of conversion to standards a little less painless.

In this article, I am going to explore the concept of applying multiple class names on elements and demonstrate how utilizing that technique can bring about significant reductions in the number of bytes a Web page utilizes. We are going to begin by taking a trip down memory lane (at least for me) and look at a simple Web document that uses tables for layouts and font tags for presentational markup.

The Old Way

In the not so distant past, the majority of developers and designers used a tables-based approach for layout and font tags for presentational markup. More often than not, this approach produced code that was barely readable and consequently difficult to understand. Nonetheless, it was and some would argue still the predominate method of providing layout and presentational aspects to Web documents and by and large served our Web building goals. To reacquaint yourselves with this method, see the following example.

View Tables Example 1 (Opens in new window.)

Our first example weighs in at 1876 bytes. While it is true that table optimization techniques can be used on this page that would reduce the number of bytes used, the document itself suffices as being representative of the general techniques employed with table design. What I mean by that, is that all the examples presented here could still be optimized further--for example we could rid ourselves of white space as one optimization technique--but that would not be the point; as we are far more interested here in a particular technique for page byte optimization rather than a compendium of optimization techniques. With that in mind let's push on.

Most developers of today are utilizing DTD's in their Web documents, so let's add a DTD to the first example and view the result.

View Tables Example 2 (Opens in new window.)

The inclusion of a DTD sees the number of bytes used rise to 1941 bytes. However let's remember that DTD's were not widely used when tables and font tags strategies were employed. Therefore feel free to compare the results presented later in this article with either of the above examples. I will leave you to decide with is the fairer comparison, but please remember that XHTML documents must include a DTD or Schema and the CSS examples are written in XHTML.


home / authoring / style / sheets / multiclass current pageTo page 2To page 3
[next]



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Tripwire Whitepaper: Seven Practical Steps to Mitigate Virtualization Security Risks
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview · Controllers: Programming Application Logic - Part 2 · How to Use JavaScript to Validate Form Data
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Choosing the Right Online Backup Provider · Mother Avaya Nurtures Her Technology Partners · Software as a Service a Winning Model for Hotspot Provider

Created: November 27, 2002
Revised: November 27, 2002

URL: http://webreference.com/authoring/style/sheets/multiclass/