Electric Type

Multimedia

About Us

News

Help

Lean and Mean HTML

Page 2 — Use Jacko Instead of Michael Jackson

Our first trick seems obvious, but sometimes people forget the obvious things (I know I certainly do). What you name your pages, images, sounds, and other files has an impact on the overall size of your HTML document.

For example, if you call your handy invisible spacer GIFs "spacer_gif.gif" and use 30 of them throughout your page, the repeated name of the image alone takes up 420 bytes in your HTML. But if you name them "a.gif" instead, it adds up to only 150 bytes - a savings of 64 percent!

Similarly, try to shorten the names of your directories and reduce the number you use. If a call to an image is SRC="website_images/all_products/jello_mold.gif", imagine how many bytes you could save by shortening the name of "website_images" and eliminating the unnecessary "all_products" directory. SRC="images/jello.gif" is a lot shorter.

Obviously, you can't eliminate all subdirectories because site maintenance would be much more difficult with every single file in the same directory, but minimizing subdirectories is definitely a good idea. Also, use relative addressing when you can. Take a look at your three choices when linking to an example HTML file:

Shorter is obviously better. But don't get me wrong: Even though anorexic code is nice, it's always a good idea to flesh it out a little with comments. There's nothing more horrifying than going back to edit an HTML file a year after creating it, only to find yourself lost amidst a sea of nested table tags, with no comments to help explain what's what. Comments like this are great:

    <!-- Top navigation -->
But don't overdo it:
    <!-- * * * * * * * * * * * * * * * * * * * * * * -->
    <!-- Top navigation begins at this point! -->
    <!-- * * * * * * * * * * * * * * * * * * * * * * -->
Also, if you have HTML code that's commented out, why not save it in another file and delete it from your live file? It's just taking up valuable space in your HTML.

next page»


Dynamic HTML  

Frames  

HTML Basics  

Stylesheets  

Tables  

XML  

Javascript  

Database Connections  

Intro To Perl  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.