Forum Moderators: open
Then I took a college class and my instructor taught us to code in capital letters because it's easier to read through, and distinguish code from content.
Now, I'm seeing advice on using lowercase again. Who's right? I'm tired of converting my code back and forth.
HTML 4.01 Specification - 1.2.1 Elements and attributes [w3.org]
XHTML 1.0 - 4.2. Element and attribute names must be in lower case [w3.org]
In XHTML it then becomes a requirement.
Which is a good reason to start using lower case now, rather than having to break the uppercase habit later. Would I convert previously created pages? Probably not, but of course it can get a little messy when you mix the two, so it depends on how picky the person you are working for is about how the code 'looks'.
Lower case or Upper case does not make any different to the file size at all (to answer one question posed above) as each character is represented by 8 binary bits, or one byte.
This is correct for a raw file, but is not true if you are using content-encoding to compress your file during transfer to a user's web browser. Files with all lowercase elements and attributes are more compressible than files with uppercase elements and/or attributes. See: Simple Test of Compressing HTML Using ZLib [w3.org]
Another thing I've never understood... why do some people type their HTML like this (ignore the underscores, this forum doesn't seem to let you have extra spaces:
<table>
_ _ _<tr>
_ _ _ _ _<td>
_ _ _ _ _ _ _<p>
_ _ _ _ _ _ _ _Blah blah blah.
_ _ _ _ _ _ _ </p>
_ _ _ _ _</td>
_ _ _ _ _<td>
_ _ _ _ _ _ _<p>
_ _ _ _ _ _ _ _Blah blah blah.
_ _ _ _ _ _ _</p>
_ _ _ _ _</td>
_ _ _</tr>
</table>
I always do mine like this:
<table>
<tr>
<td>
<p>
Blah blah blah.
</p>
</td>
<td>
<p>
Blah blah blah.
</p>
</td>
</tr>
</table>
I indent all markup (3 spaces) out of preference because I always indent code or else I can't read it when I come back later if it is not indented; at least, not without basically going through it all again. Especially with alot of nested conditionals in code or nested elements in markup.
Jordan
If you're interested in this kind of thing, search for entropy and information theory.