Results 1 to 10 of 10

Thread: Hello World

  1. #1
    Join Date
    Feb 2017
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Hello World



    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...

    Code:
    <!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">
    Code:
    <?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">
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    Code:
    <!DOCTYPE html>
    Code:
    -null-
    Optional? Suggestive?
    Code:
    <html>
    <head>
    <title>Hello World</title>
    </head>
    <body>
    <p>Hello world</p>
    </body>
    </html>
    Not referring to:
    Code:
    (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>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,374
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    Short answer - No. Oh well, maybe a filename.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2017
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default HTML DOCTYPE Declaration

    Ahh, it's called HTML DOCTYPE Declaration

    https://www.w3schools.com/tags/tag_doctype.asp

    I just found this...

    Quote Originally Posted by w3schools
    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?

    Quote Originally Posted by w3schools
    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)?

    Quote Originally Posted by w3schools
    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?

  4. #4
    Join Date
    Mar 2011
    Location
    N 11 19' 0.0012 E 142 15' 0
    Posts
    1,591
    Thanks
    57
    Thanked 99 Times in 97 Posts
    Blog Entries
    4

    Default

    Quote Originally Posted by CNT View Post
    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!
    Posting Tips + FAQ | Issues? Feel free to PM me
    - keyboard1333[at]gmail[dot]com

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,374
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    432
    Thanks
    0
    Thanked 54 Times in 50 Posts

    Default

    For the sake of cross-browser compatibility it's wise to include the following in all web pages:

    Code:
    <!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".
    Last edited by styxlawyer; 02-21-2017 at 06:29 PM. Reason: Spelling & grammar.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,374
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,734
    Thanks
    46
    Thanked 216 Times in 209 Posts
    Blog Entries
    53

    Default

    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:
    Code:
    <!doctype html>
    <html>
    <head>
    <title>whatever title you want</title>
    </head>
    <body>
    your content here
    </body>
    </html>

  9. #9
    Join Date
    Feb 2017
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Quote Originally Posted by molendijk
    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.

  10. #10
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,734
    Thanks
    46
    Thanked 216 Times in 209 Posts
    Blog Entries
    53

    Default

    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.

Similar Threads

  1. Rid the world of ie6 in a week
    By bernie1227 in forum The lounge
    Replies: 0
    Last Post: 07-15-2012, 04:58 AM
  2. Resolved How in the world do they do this: collapsible div tough one
    By jhalsey2 in forum Looking for such a script or service
    Replies: 1
    Last Post: 11-15-2010, 10:12 PM
  3. Clickable world map
    By Foundas in forum Looking for such a script or service
    Replies: 1
    Last Post: 10-03-2009, 02:59 AM
  4. Shortest Hello World?
    By Trinithis in forum Java
    Replies: 0
    Last Post: 01-22-2008, 10:08 PM
  5. world time
    By jaison in forum Dynamic Drive scripts help
    Replies: 10
    Last Post: 01-03-2008, 05:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •