Results 1 to 15 of 15

Thread: [HTML] It's actually just a template.

  1. #1

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Talking [HTML] It's actually just a template.

    A copy-and-paste template for people who are tired of writing all of the HTML, HEAD, TITLE, LINK, BODY and SCRIPT tags. Just delete the parts that don't apply to your page.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" type="text/css" href="" />
    <title></title>
    <script language="javascript" type="text/javascript" src=""> </script>
    <script language="javascript" type="text/javascript">
    </script>
    <style type="text/css">
    </style>
    </head>
    <body>
    </body>
    </html>
    Last edited by minitech; Sep 2nd, 2010 at 11:43 AM.

  2. #2
    Addicted Member
    Join Date
    Dec 2007
    Posts
    186

    Re: [HTML] It's actually just a template.

    You should really have a doctype included and meta tags. Something like this would be better:

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd"> 
    <html> 
    <head> 
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
       <link rel="stylesheet" type="text/css" href="style.css">
    
       <title>Site title here</title> 
    </head>
    <body>
    
    <!-- Content here -->
    
    </body>
    </html>
    Then if you wanted javascript in your page you could link to an external file like so:

    HTML Code:
    <script type="text/javascript" src="externalJS.js"></script>
    or have it within the html code like:

    HTML Code:
    <script type="text/javascript">
    // Your javascript goes in here.
    </script>
    The same applies for Cascading Style Sheets (CSS)

    External file:

    HTML Code:
    <link rel="stylesheet" type="text/css" href="style.css">
    Internal CSS:

    HTML Code:
    <style type="text/css">
    
    </style>

  3. #3

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: [HTML] It's actually just a template.

    Um... I already included external/internal scripts/styles, and I think DOCTYPE is a waste.

  4. #4
    Addicted Member
    Join Date
    Dec 2007
    Posts
    186

    Re: [HTML] It's actually just a template.

    You didn't include external style sheets. Also if you don't think DOCTYPE is important then you are very silly and also your html wont be valid :P
    Last edited by Banjo; Jun 4th, 2010 at 04:22 AM.

  5. #5

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: [HTML] It's actually just a template.

    Yes, I did include extrenal style sheets. What do you think the <link> is for?

    I believe that the DOCTYPE is useless and that everybody should just use a fixed standard. Go ahead and add it yourself if you want it. I can never remember what it is.

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [HTML] It's actually just a template.

    Well, there are standards. Thats why certain HTML is considered "valid", check out the W3C validator.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: [HTML] It's actually just a template.

    Yeah, but I disagree. Why should you have to include a useless, long and hard to remember tag at the start of your HTML file? Why can't everyone just use XHTML, and browsers can compensate for people that don't? That's what they already do. What I see here is 70 characters of useless data.

  8. #8
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [HTML] It's actually just a template.

    Well,

    Rhe doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in.

    The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers can render the content correctly.
    It doesn't really matter wether you find it worthless or not, because apparently it is not
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  9. #9

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: [HTML] It's actually just a template.

    Hm, every page that I write, I test using a 52-browser tester. They all render correctly without the DOCTYPE info. Go ahead and add it, though.

  10. #10
    Addicted Member
    Join Date
    Dec 2007
    Posts
    186

    Re: [HTML] It's actually just a template.

    So you would rather your html be invalid than add a DOCTYPE ? If you really don't want to remember it you can always copy and paste it or use the html 5 one:

    Code:
    <!doctype html>
    Either way they didn't make DOCTYPE's for no reason, I also find it hard to believe that it renders the same in all browsers without one. Say if you were writing a bit of html and all you had was <strong>Text</strong> then obviously that wouldn't be the same, but if you were writing a layout with css etc.. then it would render differently.

  11. #11
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: [HTML] It's actually just a template.

    Yes, if you need proof that doctype is infact needed (although, I am not sure why) check any web design/development software such as DreamWeaver and Expression Web they include the doctype in the page when you first create a html page.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  12. #12

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: [HTML] It's actually just a template.

    Yes, they do. How is that proof it's needed?
    but if you were writing a layout with css etc.. then it would render differently.
    Web page that renders the same on all browsers without using the DOCTYPE: http://minitech.webatu.com/
    A forum I coded from scratch. It uses CSS, I've tried it personally on Firefox, Chrome, IE, and Epihphany, and on that browser-testing website that lets you test the other 52 browsers across 3 OSes. No change. (Apart from on Dillo, of course.)

  13. #13
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: [HTML] It's actually just a template.

    That is because it's a very basic template.

    When using a lot of DIV's you often get tangled up in the box modal.
    Now the DOCTYPE should trigger correct rendering of that modal. Everything messed up after this is the browsers fault.
    Without the DOCTYPE the browser switches to the default rendering which renders your site like it would look like in an early IE or Netscape version.

    When you're building a really intricate template DOCTYPE is definitely a must.
    It allows you to easily validate the HTML so you can spot mistakes easily and repair them during design.

    Now can't we make a standard DOCTYPE? Basically no.
    When you look at the future, you might want to consider a whole new approach to rendering for whatever reason. Now you have a different default rendering engine. A DOCTYPE provides full backwards compatibility.

    An interesting read.

    Now that aside; for some basic javascript testing that template works just fine
    Bookmarked.
    Last edited by TheBigB; Jun 5th, 2010 at 01:05 PM.
    Delete it. They just clutter threads anyway.

  14. #14

    Thread Starter
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: [HTML] It's actually just a template.

    I give in (edited)
    I still don't understand what banjo meant about not having external CSS, though...

  15. #15
    Addicted Member
    Join Date
    Dec 2007
    Posts
    186

    Re: [HTML] It's actually just a template.

    Yeh sorry I missed that in your code.

Posting Permissions

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



Click Here to Expand Forum to Full Width