Jump to content

Doctype


rainwater
 Share

Recommended Posts

I am confused, again, trying to figure out how to put a correct doctype onto my site mainemadestuff.comI built my site using either HTML 3 or 4 with no DTD at all. I want to start changing things without going out full boar right now, like changing small things <br /> <img /> putting "" around my table values, and trying to get it a little organized. Q1. Should I do those things or wait until ready to make a new site? Q2. Should I just wait for the HTML5 change instead of doing it in XHTML?Q3. Does the below look any where near correct to use for my existing site as it is in the old 3 or4?<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">then down in the beginning of <head> put <meta http-equiv="Content-Type" content="text/html; charset-ISO-8859-1">

Link to comment
Share on other sites

1. Personally, I'd go with redoing it. Leaving it as is won't hurt though, so if you prefer to do a new site, so be it.2. I'd choose XHTML, but that's just me (and W3C), as I use XML, and need to have as most of my markup be XML based as possible. Modern movement (WHATWG, and W3C under their pressure) however says to use HTML 4.01, and migrate it to HTML 5 when the time comes (the reason? Even if you write XHTML, current browsers will read it as HTML... for me, personally, that's not a reason enough). Either way, you need to do something, as right now, your code is not valid in any DTD.3. Regardless of whether you choose an HTML or XHTML DTD, I reccomend trying to go for the strict DTD (or if not, at least code your new sites with it). You appear to have chosen the HTML 4.01 transitional instead. That's fine too. In fact, trying to first validate the site as transitional and then as strict is probably the best way to go.Do note that the line goes more like:

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

Also, this doesn't really apply to your old site, but for future's sake, I highly reccomend you use UTF-8 as encoding for your sites, especially if there is even the slightest chance of them being used by non-English speaking folk (i.e. if you plan on letting people write or plan to write some non-Latin text youself).

Link to comment
Share on other sites

Do note that the line goes more like:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

Also, this doesn't really apply to your old site, but for future's sake, I highly reccomend you use UTF-8 as encoding for your sites, especially if there is even the slightest chance of them being used by non-English speaking folk (i.e. if you plan on letting people write or plan to write some non-Latin text youself).

I cannot see the differance in my code from yours in the meta tag. Please point this out to me.So do I put the UTF-8 in there too? Like this?<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1 charset=UTF-8" />
Link to comment
Share on other sites

I cannot see the differance in my code from yours in the meta tag. Please point this out to me.So do I put the UTF-8 in there too? Like this?<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1 charset=UTF-8" />
he didn't supply an example, just pointing out what code he was referring too. Use only one charset, in this case just switch it over to UTF-8http://en.wikipedia.org/wiki/Character_encodings_in_HTML Edited by thescientist
Link to comment
Share on other sites

You had

charset-ISO

when it's

charset=ISO

Switching from an ANSI based encoding to UTF-8 is a much more dangerous undertaking than converting from an invalid to valid (X)HTML code, because if you "break" it, it may be very hard to get the right stuff back if you don't know what you're doing. Since your site doesn't use any non-Latin letters though, you're in luck - you can't possibly break anything.You can't add UTF-8, you replace the old encoding with UTF-8, like:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Now, where can things get tricky? Try to write the following as text you'd output in your code, and I mean after you've placed that UTF-8

Свещи

(it's Bulgarian, and it means "Candles")The way this forum displays is the right way. If all is OK, it should appear the same way everywhere. You're likely to observe that it doesn't display the same way on screen as in your source code. If that's the case, you need to open your HTML file in Notepad, and in the "Save As..." dialog, choose "UTF-8" in the "Encoding" dropdown menu.Note that if you had non-Latin text, you need to copy it before you do that, then paste it back into the UTF-8 document, and save the UTF-8 file. Failing to do so will result in all non-Latin characters turning to gibberish, at which point it's next to impossible (but not totally impossible... there are some specialized programs known as "hex editors" which could help) to recover the original text.

Link to comment
Share on other sites

Now, where can things get tricky? Try to write the following as text you'd output in your code, and I mean after you've placed that UTF-8
Свещи

(it's Bulgarian, and it means "Candles")The way this forum displays is the right way. If all is OK, it should appear the same way everywhere. You're likely to observe that it doesn't display the same way on screen as in your source code. If that's the case, you need to open your HTML file in Notepad, and in the "Save As..." dialog, choose "UTF-8" in the "Encoding" dropdown menu.Note that if you had non-Latin text, you need to copy it before you do that, then paste it back into the UTF-8 document, and save the UTF-8 file. Failing to do so will result in all non-Latin characters turning to gibberish, at which point it's next to impossible (but not totally impossible... there are some specialized programs known as "hex editors" which could help) to recover the original text.

Ya lost me with that info in the above quote. I realize you were talking about other languages, but I have no idea what those Bulgarian letters are or how to get them. Also when you said: "try to write the followiing as text you'd output"...I do not know what you mean by 'output'. Thank you for pointing out the code error...good eyes = vs -Another question about <meta> . Should it be closed with just <meta "info"> or should it be closed with the space and slash <meta "info" /> ? I do want to do a new site, but need to learn all this newer stuff first. I do nott want to make the new site just to change it again because I have not learned enough yet. I might just as well change this one as I go, so it might work better in the search engines now, then when I get myself up to date with the stuff since HTML3, then... I can make an effective website. That is my thought anyway; not that it is correct, and I welcome your input on this thought.This is the best forum I have found. I tried a few from the books I am going through and a couple other tutorials, but you folks are the greatest!
Link to comment
Share on other sites

You do know about this thing called "copy&paste", right? When I said "try to write", I really meant "try to copy&paste" (sorry, thought it was obvious).When I say "text you'd output", I mean text that would appear on screen. Not in attiributes, not in the head - somewhere in the body, in the contents of an element, where it will be seen on screen. For example, like:

<div>Свещи</div>

or if you're in a table

<td>Свещи</td>

etc.

Another question about <meta> . Should it be closed with just <meta "info"> or should it be closed with the space and slash <meta "info" /> ?
I thought we had this conversaion already. If you use XHTML (or anything XML based for that matter), use a slash. If you're using HTML, no slash.
Link to comment
Share on other sites

We did have the conversation about the space/ in the br tag. I just cannot get my head around knowing if I can use these in my HTML built website or not. If I put the DTD as aforhand mentioned, I thought to be able to use those closing tags < />Thank you for being so thorough with that sledgehammer getting that information into this brain.

Link to comment
Share on other sites

Thank you for being so thorough with that sledgehammer getting that information into this brain.
Hope it hurts :) . Means you're really learning it :) .
I just cannot get my head around knowing if I can use these in my HTML built website or not. If I put the DTD as aforhand mentioned, I thought to be able to use those closing tags < />
If you choose an XHTML DTD, any empty element needs a slash. This includes (and I think is not limited to) br, img, hr, link, meta (I'm trying to stress this so we don't have to go over this again for the rest of the underlined elements - the same applies to them). If you choose an HTML DTD, any empty element must not have a slash.
Link to comment
Share on other sites

Oh, I think that hammered it in...sorry.If I use an XHTML DTD in my old site, I need to put the slash in closing the empty elements.If I use a HTML DTD in my old site, I DO NOT, for any reason, put the slash in closiing the empty elements.whewww, think that one got in there...on to the next....I am sure something will hover above my head.

Link to comment
Share on other sites

Note that the W3C have stopped development of the next version of XHTML (that version being 2) and instead gone with just having an XML version of HTML 5.

Link to comment
Share on other sites

Note that the W3C have stopped development of the next version of XHTML (that version being 2) and instead gone with just having an XML version of HTML 5.
... which is the compromise they had to make under the pressure of the WHATWG, which I mentioned earlier.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...