Re: attributes

by "Bert Doorn" <bert(at)betterwebdesign.com.au>

 Date:  Fri, 19 Oct 2001 20:34:15 +0800
 To:  "HWG Basics" <hwg-basics(at)hwg.org>
  todo: View Thread, Original
G'day

 > Wouldn't defining all attributes for all elements in a page just increase
> the volume of code?

 Only use attributes that are required by the spec (bearing accessibility
issues in mind too) plus attributes you need for specific functions.  If
you're concerned with keeping files small, don't use a WYSIWYG program, or
learn how to stop it from adding lots of redundant code.

The default alignment (at least, in English) is left in all browsers that
I've ever used.  The only time I would specify the left alignment is when
the paragraph is inside another element (e.g. a DIV or TD) that has set it
to something other than left and I really want to left-align a particular
paragraph.

Similarly, it's not necessary to specify the width in every table cell.
Take a table that's 2 columns wide and 1000 rows tall.  It's only necessary
to specify the width on ONE cell.  I mean, if the top left cell is 40% of
the table width, what would the cell next to it be?  And what about the 999
cells under it?  TD width='40%' has 12 bytes of attribute.  If you specify
the width on each cell, that's an extra 1999 x 12 bytes (over 23Kb) of
wasted bandwidth

Images?  Well, use at least src, width, height and alt.   Only add
border="0" if you are using the image for a link and don't want a border.
Don't name or ID images unless you need to refer them in some script.  Only
use hspace and vspace if you need to.  Etc.

Having said all that...  Text compresses very well and most modern modems
use some level of compression.  A 30Kb HTML file with 20Kb of images should
theoretically load much faster than a 1Kb HTML file with 49Kb of images.

HTH
--
Bert Doorn, Web Developer
http://www.betterwebdesign.com.au/
Beginners Web Design Tutorial
http://www.bwdzine.com/bwdt/

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA