SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Jan 2012
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Switching to HTML5

    I'm thinking of converting my websites to HTML5 and wanted to solicit some advice. There's tons of information online, but I haven't yet answered some basic questions.

    A little background: I was quick to adopt XHTML when I first started learning about web design several years ago. However, I discovered that many pros were still sticking with HTML. Eventually, I realized that XHTML wasn't worth the trouble, so I switched back to HTML. The main thing I remember is all the time I spent converting my closing tabs - adding the backward slash to breaks and images, for example.

    I assume there are regular expressions that can convert image tags in text files, but what about content stored in databases? Is there some sort of regex search and replace function I can use on database tables?

    If I switch to HTML5, what tags would I have to convert besides images? It looks like break tags don't need the backwards slash.

    Are there any other things I should be aware of before I take the plunge? It sounds like once I switch, HTML5 might actually be a little easier to work with. I certainly like the new doctype.

    Thanks for any tips.

  2. #2
    Mouse catcher silver trophy
    Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,819
    Mentioned
    110 Post(s)
    Tagged
    1 Thread(s)
    One of the overarching principles behind HTML5 was that it should not break anything that was legitimate HTML4, although there were a handful of particularly obscure tags that I think are being excluded from the specification. So if your site validates as HTML4 then it should continue to validate as HTML5. What you have is a load of extra tags, which you can incorporate into your design templates and forms as and when you wish.

    I know there are people out there who have adopted the HTML5 doctype but haven't changed anything else in their markup at all!

  3. #3
    SitePoint Addict
    Join Date
    Jan 2012
    Posts
    253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So if I don't change all my image tags, they'll still work fine? Wow, I think I'm sold! Thanks for the tip.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,593
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    By the time (X)HTML5 actually becomes a standard the last of the browsers to not support XHTML (IE8) will hopefully be dead and you might find that a lot of the pros who have been waiting for XHTML to start working might switch to using XHTML5 instead of HTML5.

    Certainly all of the browsers that support HTML5 fully will also fully support XHTML5.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Member
    Join Date
    Jun 2013
    Location
    Edmond, WV
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can safely switch all of your xHTML work to HTML5, it is supported in all browsers. You can even get support with IE6,7,8 but for that you would need to use https://code.google.com/p/html5shiv/ , or just use Modernizr which can add that for you. It's really easy to use and it is a good change. I've been working as a PSD to HTML person for around 4 years and i was reluctant to change, i just did it last summer when at least 60% of jobs required HTML5. It's a really easy transition coming over from xHTML 1.0 strict to HTML5. You can basically use everything that you have and just change the doctype, but HTML5 is incredibly semantic and I would really recommend taking advantage of all of it's new tags. Cheers!

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,593
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ioan View Post
    You can safely switch all of your xHTML work to HTML5, it is supported in all browsers. You can even get support with IE6,7,8
    You can safely switch all of your XHTML work to XHTML5, it is supported in all modern browsers - it is only IE8 and earlier that don't support XHTML.

    Note that with XHTML5 you don't need a doctype at all as quirks mode only exists with HTML - XHTML only has standards mode.

    Using PHP I'd use the following as a starting point for XHTML5 pages (you need the content header set using a server side language unless you have your server set up to default to XHTML instead of HTML):

    Code:
    <?php
    header("Content-Type: application/xhtml+xml; charset=utf-8");
    echo '<'.'?xml version="1.0" encoding="UTF-8"?','>';
    ?>
     <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
     <title>An XHTML 5 Template</title>
     ...
     <link rel="stylesheet" href="css/main.css"/>
     </head>
     <body>
     <header>
     ...
     </header>
     <main>
     <article>
     ...
     </article>
     <aside>
     ...
     </aside>
     </main>
     <nav>
     ...
     </nav>
     <footer>
     ... </footer>
     <script type="application/javascript" src="myscript.js"/>
     </body>
     </html>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Tags for this Thread

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
  •