Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lowercasing code question

Status
Not open for further replies.

robert89

Technical User
Nov 19, 2003
125
CA
Hi there,
New to XHTML and wonder if anyone can tell if it is neccessary to lowercase the content in an alt tag and title tag. I have been using some software that rewrites my code from sentence case to lowercase in title and alt tags. I can't find a switch to turn it off, but didn't think it was necessar either.

Thanks,
Bob
 
No, there are no restrictions on the content of any attributes. It can be done in any case you want. Your software must use poorly written regular expressions to keep all attribute names lowercase.
 
While it is true that attributes can be mixed case, remember that tags MUST be in lower case. This is because XHTML documents are XML applications, and XML is case sensitive.

And since XML is case-sensitive, if you mix your cases when defining attributes, you're going to have to remember to always specify the attribute in the exact same mixed-case way every time you refer to it. That may not be an issue with the 'alt' attribute in your example, but it might be an issue in the case of a 'name' or 'id' attribute.

Why not follow convention and make your attributes all lower case, thereby maybe making it easier for the next developer who has to maintain your code several years from now?

Oh, and by the way, mixed case attributes will not validate as valid XHTML 1.0:

W3C said:
4.2. Element and attribute names must be in lower case

XHTML documents must use lower case for all HTML element and attribute names. This difference is necessary because XML is case-sensitive e.g. <li> and <LI> are different tags

Mike Krausnick
Dublin, California
 
yes, the attributes and tags themselves must be lower-case, but the values within the attributes do not have to comply to the rule (as Vragabond said):

Code:
<img src="myFile.jpg" title="This Is My Image" alt="some Alternative TEXT GOES here" />

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

BillyRayPreachersSonIsTheLeetestHax0rDude
[banghead]
 
Wow, I certainly mis-read this thread! My apologies - I didn't pick up that you were asking about the CONTENT of the tag, not the tag itself.

Where's the coffee pot, I need another cup.


Mike Krausnick
Dublin, California
 
Hi Mike,
Full of admiration that you would confess to having misread. I find the items are usually misread. Yes, indeed I was only speaking of the content of the tag. The program that is causin me heart ache is Namo. Powerful web editor at a fraction of dreamweavers cost, but they keep producing product with annoying little bugs.

Thanks for response.
Bob
 
I brushed up against Namo once while giving advice to a volunteer webmaster. I advised her to use what I use - which is HTML-Kit. It's free and does everything I need. There's incredible user support that has generated hundreds of add-ins for every concievable task. Built-in drag & drop FTP upload, preview pane, specialized editing support for all scripting languages, etc.

Check it out.

Mike Krausnick
Dublin, California
 
I decided to take a peek at this HTML-Kit that you talk about... the site describes a powerful tool.

Try as I might I was unable to find a contact email address, and I was unable to find the answer to my question: "Will it work on MacOSX?". I couldn't post to their support forums without registering (and even that looks like a nightmare) and their FAQ section doesn't seem to deal with the issue at all.

There are tantalising suggestions that it works on a Mac, but no download option or documentation seems to follow up on it. Maybe there is a secret page for Mac users when they visit the site using MacOSX... I was visiting using a Windows browser.

Oh well :)

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Hi Mike,
Use I have this on my machine. I have Namo for wyswyg purposes. I am a devoted believer in W3C and anything they recommend.
Jeff, I remember there being some initail annoyance with getting to the full download, but after that found everyting I need without problem. Sorry to hear you had such a rough time.

Bob
 
Hehe... I'll take a peek from home using Safari and see if I get served different pages. No stress :)

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]

What is Javascript? faq216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top