Rules
Terms of Use

Topic Options
#192007 - Tue Sep 02 2003 06:57 AM XHTML Compatibility Question
achernar Offline
Prolific

Registered: Fri Jun 06 2003
Posts: 1336
Loc: Mumbai India                  
There are several HTML tags which don't need to be closed, like <br>, <hr>, <img>, <link> that don't need to be closed (there is a techie-term for these tags which I just can't recall).

Anyway, to be compatible with the new XHTML 1 standards and the browsers of the future, you have to include a / (slash) within this type of tags. My problem is - where does the / go?

Some people include it straight after the text in the tag like this:

<img src="hello.gif" alt="hello!"/>

And others leave a space between the text and the / (which is what I have been doing):

<img src="hello.gif" alt="hello!" />

My question is - Which method is preferable?


Edited by harish_256 (Sun Dec 28 2003 11:25 PM)

Top
#192008 - Tue Sep 02 2003 01:24 PM Re: XHTML Compatibility Question
tellywellies Offline
Forum Champion

Registered: Sat Apr 13 2002
Posts: 5473
Loc: South of England
Your second example is correct Harish, so you have been doing the right thing. I tried using a free utility called TidyGUI, which gives an option to convert HTML pages to XHTML automatically. It made a real mess of some of my tables though. I might try and resolve that one of these days. Download it here if you want try it. You'll find that once it's finished doing it's job it leaves a space before the forward slash. It's best to back up your page before trying it out.

XHTML is somewhat of a progression from HTML. The code is less bloated than HTML and web pages in the future are likely to be written using it. A good explanation of what XHTML is about and why the change of from HTML is needed can be found here.
_________________________
Error: Keyboard not attached. Press any key to continue..

Top
#192009 - Tue Sep 02 2003 02:30 PM Re: XHTML Compatibility Question
sue943 Offline
Administrator

Registered: Sun Dec 19 1999
Posts: 38005
Loc: Jersey
Channel Islands    
Oh brilliant, I don't think! I have about 1,500 or so pages all in html and most of my tags are in uppercase. Having read that article I can see that I am going to be extremely busy at some stage, I really don't have time for messing about altering all those files.
_________________________
Many a child has been spoiled because you can't spank a Grandma!

Top
#192010 - Tue Sep 02 2003 07:12 PM Re: XHTML Compatibility Question
achernar Offline
Prolific

Registered: Fri Jun 06 2003
Posts: 1336
Loc: Mumbai India                  
Thank goodness I was right about that one, more than my web pages, it's been my quizzes in which I've been using <br />! Phew!

I don't think I should need TidyGUI, because I've tried to keep all the HTML I've written so far compatible with future standards, and plus, I haven't created to many HTML documents. I'll download it anyway, though.

About the case of tags, fortunately I had always been using lowercase, so that's a lot of work taken off my shoulders...how I pity you, Sue!

One thing that really irritates me is that in school they're teaching us a really out-dated version of HTML, where you can include tags like <center> (now made obsolete by <div align="center">)and formatting tags like <font> within the <head> tag...


Edited by harish_256 (Sun Dec 28 2003 11:26 PM)

Top
#192011 - Tue Sep 02 2003 07:17 PM Re: XHTML Compatibility Question
ladymacb29 Offline
Moderator

Registered: Wed Mar 15 2000
Posts: 16214
Loc: The Delta Quadrant
Hey - all I know is the outdated HTML! Found this out when my boyfriend was helping me with a website... He said "Um, this is really ancient coding here." Geesh, and here I was thinking I was just keeping things simple.
_________________________
"Without the darkness, how would we see the light?" ~ Tuvok

Editor for Television Category

Top
#192012 - Wed Sep 03 2003 12:22 AM Re: XHTML Compatibility Question
tellywellies Offline
Forum Champion

Registered: Sat Apr 13 2002
Posts: 5473
Loc: South of England
I've got 125 pages in my site and I don't really fancy going through them coverting to XHTML. I might just do it as an interesting exercise sometime (when the dark evenings set in and there's nothing good to watch on the telly).

We're encouraged to convert to XHTML in order to 'future-proof' our web pages. The concept is that tomorrow's browsers will only need to understand one standard code. This would make Browsers more lightweight for use with phones or whatever else might be used to browse the Internet. Pages that contain code straying from the XHTML standard would not display properly.

It's a nice ideal but I can't see it happening in practice. The demand from everyone who uses the Web, and many who write pages for it, is for browsers to be tolerant of 'bad code' in web pages. Most surfers aren't worried what code lies behind a web page so long as the page looks alright in Internet Explorer on their Desktop or Laptop PC.

If Microsoft were to say, "OK, our new browser will work only with correctly written XHTML" then we'd have to sort out our web pages. This seems unlikely though. Also, there is a tendancy for other Browsers to follow suit these days and cater for HTML Standard variations.

I suppose if you want web pages to be compatible with browsing Internet using mobile phones etc then the convertion needs doing. If not, I don't think we need to worry about it too much ...at least not for a good while.

The ideal of creating a standard isn't new. Web pages are supposed to be written to a rigid W3C HTML standard (more info here) but many are not. Some pages look different depending on what browser is used.
_________________________
Error: Keyboard not attached. Press any key to continue..

Top
#192013 - Wed Sep 03 2003 03:35 AM Re: XHTML Compatibility Question
achernar Offline
Prolific

Registered: Fri Jun 06 2003
Posts: 1336
Loc: Mumbai India                  
Quote:

It made a real mess of some of my tables though.



Fortunately I haven't bothered to learn about or use tables yet, I just haven't found the need!

I'd once tried looking around the W3C site, but I got so thoroughly lost I just gave it up... I think I'll give it another look now. I don't think I should have too much trouble converting my site, the biggest problem probably will be putting all those numbers in quotes " " and adding the alt attribute to all my img tags.


Edited by harish_256 (Sun Dec 28 2003 11:27 PM)

Top
#192014 - Wed Sep 03 2003 11:59 AM Re: XHTML Compatibility Question
sue943 Offline
Administrator

Registered: Sun Dec 19 1999
Posts: 38005
Loc: Jersey
Channel Islands    
To be honest I cannot see that the pages I create and edit being practical for use on a phone, they are pure text with just a logo in one corner and would be impossible to read on a two inch screen.

I suppose I will have to start using lowercase which is irritating as I used to use it when I first started writing pages over seven years ago but changed to uppercase to make it more visible for when I edit. I do tend to use tables quite a lot, There are a couple on every page and some pages have quite a number, some are huge with the coding filling 50 or more sheets of A4 if printed.
_________________________
Many a child has been spoiled because you can't spank a Grandma!

Top
#192015 - Sun Dec 28 2003 11:33 PM Re: XHTML Compatibility Question
achernar Offline
Prolific

Registered: Fri Jun 06 2003
Posts: 1336
Loc: Mumbai India                  
I have been attempting to give my site a complete revamp, along with colours, fonts, etc., and have tried to keep it as XHTML-compatible as possible. Unfortunately, this is really slow, tedious work, and is taking up a lot of time!

Anyway, getting to the point, I'm having trouble understanding the bit about internal links. I've always been using <a name="..."> for internal-linking, but the site TW gave says that I'll also have to do something else:


Quote:

6. Internal Links
Internal links in HTML were made using a combination of the <a> tag and the name attribute. In XHTML, to go along with XML, you use the id attribute to make these links instead of the name attribute. For a while you should probably include both so that your links still work on older browsers, but this will be the method used in future. The name attribute has been deprecated.

<a href="#section">link</a>
<p id="section" name="section"></p>

Since all tags can take the id attribute, you can now make links to any element on your page. Most helpful if you add the link to a heading or specific paragraph.




I'm having trouble understanding -- what's the difference between the id and name attribute? Do the both fulfil the same purpose or do they have different functions?

Top

Moderator:  flopsymopsy, ladymacb29