By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,543 Members | 2,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,543 IT Pros & Developers. It's quick & easy.

HTML UPPER case or lower case?

P: n/a
Should HTML 4.01 Strict markup be done in upper case or in lower case?
I understand that HTML allows either upper or lower case. I also notice
that XHTML apparently requires lower case. However I saw some mention
that the HTML DOM uses upper case for markup elements.

So, should I worry about what this means?

I am inclined to go with lower case, for two reasons.

Easier to change if I subsequently want to use XHTML.
Easier to type.

--
http://www.ericlindsay.com
Nov 23 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
In article <NO********************************@freenews.iinet .net.au>,
Eric Lindsay <NO**********@ericlindsay.com> wrote:
I am inclined to go with lower case, for two reasons.

Easier to change if I subsequently want to use XHTML.
yep.
Easier to type.


yep.

You answered your own question :-)
I used to make my elements upper case because I think I saw it
somewhere, sometime, a long time ago. I had my text editor convert them
to lower case a few years ago.

leo

--
<http://web0.greatbasin.net/~leo/>
Nov 23 '05 #2

P: n/a
In article <NO********************************@freenews.iinet .net.au>,
Eric Lindsay <NO**********@ericlindsay.com> wrote:
Should HTML 4.01 Strict markup be done in upper case or in lower case?
I understand that HTML allows either upper or lower case. I also notice
that XHTML apparently requires lower case. However I saw some mention
that the HTML DOM uses upper case for markup elements.


As a caveat to my previous post, I've always used uppercase in the
places I've understood it to be in a DTD. From <html> to </html>, I use
lowercase.

leo

--
<http://web0.greatbasin.net/~leo/>
Nov 23 '05 #3

P: n/a
Tim
On Tue, 15 Nov 2005 09:50:26 +1000, Eric Lindsay sent:
Should HTML 4.01 Strict markup be done in upper case or in lower case?
Doesn't matter.
I am inclined to go with lower case, for two reasons.

Easier to change if I subsequently want to use XHTML.
If you were converting an HTML document to XHTML, your best bet would
probably to use a tool designed to do so. As well as making sure that
it's correctly formed, upper- vs lower-case wise, it takes care of other
things, to.
Easier to type.


As good a reason as any.

--
If you insist on e-mailing me, use the reply-to address (it's real but
temporary). But please reply to the group, like you're supposed to.

This message was sent without a virus, please destroy some files yourself.

Nov 23 '05 #4

P: n/a
Eric Lindsay wrote:
Should HTML 4.01 Strict markup be done in upper case or in lower
case? I understand that HTML allows either upper or lower case. I
also notice that XHTML apparently requires lower case. However I saw
some mention that the HTML DOM uses upper case for markup elements.

So, should I worry about what this means?
Not at all. Elements in HTML 4.01 Strict (or all pre-XHTML versions of
HTML, for that matter) are case-insensitive, meaning that it doesn't
matter if you have your tags in upper or lower case.

The examples you've seen sometimes use upper case tags (with lower case
attributes) are just to show a form of seperation between HTML tag
elements and all other text. It also helps some people read and
maintain their own HTML code.

Same thing goes for indentation. There's no requirement that your code
must be indented or on separate lines, other than that the DOCTYPE
element must be on top and on a line by itself. Indentation and line
breaks does, however, serve for easier maintenance by the creator and
other coders that needs to update the HTML page at later times.
I am inclined to go with lower case, for two reasons.

Easier to change if I subsequently want to use XHTML.
Easier to type.


Exactly. So if you're planning on switching to XHTML at a later point,
lower case code would help. Then it's just a matter of switching the
DOCTYPE, closing all tags (both empty and non-empty) and make sure tags
are properly nested (in other words: fix all validation errors, one by
one).

--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Nov 23 '05 #5

P: n/a
Kim André Akerø wrote:
Same thing goes for indentation.
Nope. Indentation can be significant. Case distinction in element and
attribute names (and in enumerated attribute values) in HTML isn't.

Consider this:

<td><img ...>
</td>

This is by HTML definition equivalent to

<td><img ...></td>

Contrast this with

<td><img ...>
</td>

(i.e. with one-character indentation). It is equivalent to

<td><img ...> </td>

This can make a difference when a browser thinks that it needs to render
the space (which is a foolish idea, but browsers do such things).

On the practical side, most browsers get the first equivalence wrong
(they never bothered learning to parse HTML correctly) and produce the
same effect as in the second case. This, in turn, implies that using
"prettyprinted" layout in HTML is risky. You need to know what you doing
and how whitespace can be significant.
There's no requirement that your code
must be indented or on separate lines, other than that the DOCTYPE
element must be on top and on a line by itself.
Where did you get that idea about the "DOCTYPE element"? (It ain't no
element, BTW.)
So if you're planning on switching to XHTML at a later point,
lower case code would help. Then it's just a matter of switching the
DOCTYPE, closing all tags (both empty and non-empty) and make sure tags
are properly nested (in other words: fix all validation errors, one by
one).


Actually, it's more, and less. It's more e.g. because the content model
of <script> and <style> are different in XHTML. It's less because HTML,
too, requires proper nesting. Lower case vs. upper or mixed case is
perhaps the most trivial part of the conversion.
Nov 23 '05 #6

P: n/a
Jukka K. Korpela wrote:
Kim André Akerø wrote:
Same thing goes for indentation.
Nope. Indentation can be significant. Case distinction in element and
attribute names (and in enumerated attribute values) in HTML isn't.


Significant, yes. Required, no.

Although, I must admit indentation is significant in terms of adding
whitespace to the rendered document.
[snip code examples]
There's no requirement that your code
must be indented or on separate lines, other than that the DOCTYPE
element must be on top and on a line by itself.


Where did you get that idea about the "DOCTYPE element"? (It ain't no
element, BTW.)


Terribly sorry, I did mean "DOCTYPE declaration". It was late, and my
English tends to be heavily crippled at 4am (considering Norwegian is
my native language).
So if you're planning on switching to XHTML at a later point,
lower case code would help. Then it's just a matter of switching the
DOCTYPE, closing all tags (both empty and non-empty) and make sure
tags are properly nested (in other words: fix all validation
errors, one by one).


Actually, it's more, and less. It's more e.g. because the content
model of <script> and <style> are different in XHTML. It's less
because HTML, too, requires proper nesting. Lower case vs. upper or
mixed case is perhaps the most trivial part of the conversion.


To my defense, my thought process (along with my English) wasn't "all
there" when I typed out my post (for the reasons mentioned above), so
in hindsight, I admit I skipped a few sections.

HTML does require proper nesting, but with the buggy browsers, it's
easy to forget to close all open tags since it "appears to be working"
(an all-too-frequent quote from several of my coder acquaintances; not
word-for-word, however).

--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Nov 23 '05 #7

P: n/a
On Tue, 15 Nov 2005, Jukka K. Korpela wrote:
<td><img ...>
</td>

This is by HTML definition equivalent to
<td><img ...></td>

Contrast this with
<td><img ...>
</td>

(i.e. with one-character indentation). It is equivalent to
<td><img ...> </td>


I don't get it!
http://www.w3.org/TR/html4/struct/text.html#whitespace
says "Line breaks are also white space characters."

--
Netscape 3.04 does everything I need, and it's utterly reliable.
Why should I switch? Peter T. Daniels in <news:sci.lang>

Nov 23 '05 #8

P: n/a
On Tue, 15 Nov 2005 09:50:26 +1000, in
comp.infosystems.www.authoring.html , Eric Lindsay
<NO**********@ericlindsay.com> in
<NO********************************@freenews.iinet .net.au> wrote:
Should HTML 4.01 Strict markup be done in upper case or in lower case?
I understand that HTML allows either upper or lower case. I also notice
that XHTML apparently requires lower case. However I saw some mention
that the HTML DOM uses upper case for markup elements.

So, should I worry about what this means?

I am inclined to go with lower case, for two reasons.

Easier to change if I subsequently want to use XHTML.
Easier to type.


PeRsOnAlLy I tHiNk ThAt We ShOuLd AlL uSe MaSsIvElY mIxEd CaSe. ThErE
iS tOo MuCh CoMmUnIcAtIoN aS iT iS. i JuSt DoN't KnOw If I sHoUlD
cOnSidEr SpAcEs AnD pUnCtUaTiOn.

(CoRrEcTiNg TyPo'S iS a BiTcH, tHoUgH.)
--
Matt Silberstein

Do something today about the Darfur Genocide

http://www.beawitness.org
http://www.darfurgenocide.org
http://www.savedarfur.org

"Darfur: A Genocide We can Stop"
Nov 23 '05 #9

P: n/a
Andreas Prilop <nh******@rrzn-user.uni-hannover.de> wrote:
On Tue, 15 Nov 2005, Jukka K. Korpela wrote:
<td><img ...>
</td>

This is by HTML definition equivalent to
<td><img ...></td>

Contrast this with
<td><img ...>
</td>

(i.e. with one-character indentation). It is equivalent to
<td><img ...> </td>


I don't get it!


See http://www.w3.org/TR/html4/appendix/...es-line-breaks

--
David Håsäther
Nov 23 '05 #10

P: n/a
Kim André Akerø <ki******@NOSPAMbetadome.com> wrote:
Although, I must admit indentation is significant in terms of adding
whitespace to the rendered document.


It may, or it may not, as I explained.
Where did you get that idea about the "DOCTYPE element"? (It ain't no
element, BTW.)


Terribly sorry, I did mean "DOCTYPE declaration".


You didn't tell where you got the idea that the DOCTYPE declaration "must be
on top and on a line by itself". (It must appear before any element, but
whitespace and comments are allowed before it, though - not surprisingly -
IE gets this wrong in its DOCTYPE sniffing.)

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Nov 23 '05 #11

P: n/a
Jukka K. Korpela wrote:
Kim André Akerø <ki******@NOSPAMbetadome.com> wrote:
Although, I must admit indentation is significant in terms of adding
whitespace to the rendered document.


It may, or it may not, as I explained.
Where did you get that idea about the "DOCTYPE element"? (It ain't

no >> element, BTW.)

Terribly sorry, I did mean "DOCTYPE declaration".


You didn't tell where you got the idea that the DOCTYPE declaration
"must be on top and on a line by itself". (It must appear before any
element, but whitespace and comments are allowed before it, though -
not surprisingly - IE gets this wrong in its DOCTYPE sniffing.)


"On top" serves the same description as "before anything else" to me.
And was under the impression that "by itself" meant that something like
this isn't allowed:

<!DOCTYPE ...><html> [...]

While this is allowed:

<!DOCTYPE ...>
<html> [...]

--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Nov 23 '05 #12

P: n/a
In article <Xn***************************@195.67.237.53>,
David Håsäther <ha******@msn.com> wrote:
Andreas Prilop <nh******@rrzn-user.uni-hannover.de> wrote:
On Tue, 15 Nov 2005, Jukka K. Korpela wrote:
<td><img ...>
</td>

This is by HTML definition equivalent to
<td><img ...></td>

Contrast this with
<td><img ...>
</td>

(i.e. with one-character indentation). It is equivalent to
<td><img ...> </td>


I don't get it!


See http://www.w3.org/TR/html4/appendix/...es-line-breaks


So

<p>
This is a
<a href="http://blah.com/">LINK</a>
to some good stuff.<p>

should be rendered as

This is aLINKto some good stuff.

I.e. no space around the underlined "link"?
That would mess up many of my web pages if browsers actually did it.

--
= Eric Bustad, Norwegian bachelor programmer
Nov 23 '05 #13

P: n/a
Eric Kenneth Bustad wrote:
See http://www.w3.org/TR/html4/appendix/...es-line-breaks


So

<p>
This is a
<a href="http://blah.com/">LINK</a>
to some good stuff.<p>

should be rendered as

This is aLINKto some good stuff.


No, only the line break after a start tag or before an end tag is affected
(here only the line break after <p>).

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Nov 23 '05 #14

P: n/a
Kim André Akerø wrote:
And was under the impression that "by itself" meant that something like
this isn't allowed:

<!DOCTYPE ...><html> [...]

While this is allowed:

<!DOCTYPE ...>
<html> [...]


Both versions are allowed, what made you think the first wasn't?

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Nov 23 '05 #15

P: n/a
Lachlan Hunt wrote:
Kim André Akerø wrote:
And was under the impression that "by itself" meant that something
like this isn't allowed:

<!DOCTYPE ...><html> [...]

While this is allowed:

<!DOCTYPE ...>
<html> [...]


Both versions are allowed, what made you think the first wasn't?


Good question, indeed.

I did some research just to figure out why I originally thought that,
and from what I could tell, I must've been scarred by the code examples
out there. Every single (valid) code example I've seen, has used the
DOCTYPE declaration on a line of its own, even the W3C validator FAQ.
http://validator.w3.org/docs/help.html#faq-doctype

That way, I've always been under the impression that it should be on a
line on its own. Time to re-adjust my SGML knowledge, I guess.

It does, however, make good coding practice to make your code readable,
though (and at the very least seperate sections from eachother).

--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Nov 23 '05 #16

P: n/a
On 16 Nov 2005, Kim Andr? Aker? wrote:
From: =?utf-8?Q?Kim_Andr=E9_Aker=F8?= <ki******@NOSPAMbetadome.com>

^^^^^ ^^^ ^^^

This is impossible!
Please do not use special letters in your address
if your newsreader is unable to encode them correctly.

--
Netscape 3.04 does everything I need, and it's utterly reliable.
Why should I switch? Peter T. Daniels in <news:sci.lang>

Nov 23 '05 #17

P: n/a
Kim André Akerø wrote:
the DOCTYPE element must be on top and on a line by itself


Nope.

http://examples.tobyinkster.co.uk/minimal-strict.html

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Nov 23 '05 #18

P: n/a
Andreas Prilop wrote:
On 16 Nov 2005, Kim Andr? Aker? wrote:
From: =?utf-8?Q?Kim_Andr=E9_Aker=F8?= <ki******@NOSPAMbetadome.com>

^^^^^ ^^^ ^^^

This is impossible!
Please do not use special letters in your address
if your newsreader is unable to encode them correctly.


I know, I constantly forget to check that the character encoding for my
posts are ISO-8859-1.

--
Kim André Akerø
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Nov 23 '05 #19

P: n/a
begin quotation
from Eric Lindsay <NO**********@ericlindsay.com>
in message <NO********************************@freenews.iinet .net.au>
posted at 2005-11-14T23:50
Should HTML 4.01 Strict markup be done in upper case or in lower case?
I understand that HTML allows either upper or lower case. I also notice
that XHTML apparently requires lower case. However I saw some mention
that the HTML DOM uses upper case for markup elements.
I recommend using lower case. If you use DOM, you can use upper case
there.
So, should I worry about what this means? I am inclined to go with lower case, for two reasons. Easier to change if I subsequently want to use XHTML.
Easier to type.


If you insist on using upper case, you can convert it later with HTML
Tidy. However, these are definitely two good reasons to use lower case.

--
___ _ _____ |*|
/ __| |/ / _ \ |*| Shawn K. Quinn
\__ \ ' < (_) | |*| sk*****@speakeasy.net
|___/_|\_\__\_\ |*| Houston, TX, USA
Nov 23 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.