View Full Version : Hello World
https://cloud.graphicleftovers.com/19421/304050/translate-earth-languages-say-hello-world.jpg
What does every webpage must have? What are those "called"? Does an index.html page have something that the other pages don't need? I tried search for that on the 'net to learn about those, but I am not finding such? What what be the minimum requirement(s)? Other would be suggestive (as well could be requirement too?)? Those work on browsers as well mobile phones, PC vs Apple, etc...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE html>
-null-
Optional? Suggestive?
<html>
<head>
<title>Hello World</title>
</head>
<body>
<p>Hello world</p>
</body>
</html>
Not referring to:
(assuming all this below MUST be in the <head> section)
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="script.js"></script>
jscheuer1
02-21-2017, 01:53 AM
Short answer - No. Oh well, maybe a filename.
Ahh, it's called HTML DOCTYPE Declaration
https://www.w3schools.com/tags/tag_doctype.asp
I just found this...
The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag.
It doesn't say every webpage, so it only needed to be declared in index.html (or index.php) and no other webpages?
The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.
So, for today's standard, we're pass that stage, as technology gets better? As it continue quotes "HTML5 is not based on SGML, and therefore does not require a reference to a DTD." Was it ever a requirement before (HTML4 and earlier versions)?
Tip: Always add the <!DOCTYPE> declaration to your HTML documents, so that the browser knows what type of document to expect.
So, this is suggestive ("Tip") then?
Are we to assume that "all" browsers are capable of reading HTML5 by now? Is this the reason why we no longer need any declaration now?
If it would still be suggested to include the declaration, I would pick ONE of the following: (YES or NO?)
HTML 4.01 Strict
or
HTML 4.01 Transitional
or
HTML 4.01 Frameset (would it make sense to use this one since it's "everything"?)
Once again, in HTML5, it's only "<!DOCTYPE html>", should that be included (suggestive) or better use one of the HTML4 declaration or NOTHING at all?
keyboard
02-21-2017, 07:17 AM
Once again, in HTML5, it's only "<!DOCTYPE html>", should that be included (suggestive) or better use one of the HTML4 declaration or NOTHING at all?
<!DOCTYPE html> should be fine!
jscheuer1
02-21-2017, 02:14 PM
All you really need is a filename. But having a DOCTYPE is a really good idea most of the time, and an HTML 5 DOCTYPE is perhaps the easiest to work with, though it depends upon your knowledge of and experience with the DOCTYPES. There's nothing wrong with any of them or none if you know how to use them and code to them or without one. Using no DOCTYPE is perhaps now the hardest to work with, except of course on a blank page or on a very simple page.
styxlawyer
02-21-2017, 06:27 PM
For the sake of cross-browser compatibility it's wise to include the following in all web pages:
<!doctype html>
<html lang="en">
<head>
<title>Title</title>
</head>
<body>
</body>
</html>
Regarding your question about file names, when visiting a web site the server will search for any file with the name "index", "default" or "home" and an extension of "htm", "html", "shtml", "php" or "asp" (I may have missed some) and serve the first one it finds. It it doesn't find any of those it will return a 404 (Page Not Found) error. If you have a named page such as "thisIsMyFirstPage.html", it must be requested by name (including the extension) like this "http://thisIsMyWebSiteAddress.com/thisIsMyFirstPage.html".
jscheuer1
02-21-2017, 07:08 PM
If there is no default or index (home, etc - basically a default page for the folder), and you navigate to the folder (not to any particular page) many servers will show the contents of the folder automatically. It's only when you are navigating to a specific page and it's not there that you get 404 Not Found. Some servers are configured to not show the directory when the index, etc. is missing. Often you will get a Forbidden error in that case (forget the error number for forbidden off hand, but it has one). But servers often will simply redirect. Many of these things can be setup specifically on each server, but most of the time you will either get a Forbidden or see the folder contents when there is no default page.
molendijk
02-21-2017, 09:46 PM
As for styxlawyer's answer, it should only apply to pages written in English. If you have a Dutch site, you would do <html lang="nl">. A German site: <html lang="de"> etc. But a reference to a language is not required. So the following would be alright:
<!doctype html>
<html>
<head>
<title>whatever title you want</title>
</head>
<body>
your content here
</body>
</html>
As for styxlawyer's answer, it should only apply to pages written in English. If you have a Dutch site, you would do <html lang="nl">. A German site: <html lang="de"> etc. But a reference to a language is not required.
So, if I do include "<html lang="en">", it would only be readable in English browsers? If someone in German pull up an "<html lang="en">" website, what happens? Sometime, I cross few websites that Google pops a little window asking if I want a translator. Is that how it works?
If I don't use "<html lang="en">", what happens? The coding still typed in English? HTML references like address, details, dialog, embed, menu, picture, etc are all English words.
molendijk
02-21-2017, 11:42 PM
Translation tools can use the language attributes to recognize pages or sections of text in a particular language. Browsers have recently begun to allow users to check the spelling of the text they type into forms etc. But at the moment, nothing sensational will result from not providing a language attribute for a page, or from providing a wrong language attribute for it. That may change in the future. So there's nothing to be worried about right now.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.