dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: XHTML and HTML5

Hybrid View

  1. #1
    Join Date
    Jul 2013
    Location
    Glasgow, Scotland
    Posts
    4

    XHTML and HTML5

    After a day or so spent wrestling with a problem - it's time to seek help from those with much more savvy than myself, which is probably most, I am not a native coder and neither am I overly familiar with the way CSS renders things all over a webpage...and many other technical aspects and get by with a lot of trial and error...

    Now, that's out of the way, let me continue. I recently resurected an old project which seen a Joomla site converted into static XHTML, complete with CSS and javascript files for whatever was required and much work with the pages, removing any PHP and tons of other redundant tags, messing about with replacement external javascript things like image rotators and further making sure the sites original java functions were operational also - Then more messing about validating the various pages via the WC3 site until all passed. Great!

    Well, recently I copied and pasted a chunk of code from a HTML5 page into an XHTML page, linked all relevant CSS and after a lot of fiddling about, eventually got the pasted code lined up underneath the original pages menu and it looks cool, the pasted code is actually a newspaper themed layout, complete with custom fonts and css.

    It looks really good and is exactly what I had in mind when starting out, however, when I validated with WC3 it returned about a dozen errors, relating to the tags of the HTML5 code mostly. I understand that the document itself is XHTML1 Transitional and the validator is looking for specific mark up, so <header> for example rings alarm bells.

    I know such a project is probably bordering on lunacy, however the Joomla site created the perfect layout I wanted and all is pretty much good so far, but there is 2 things that have gave me cause to worry - and that is having to learn how to somehow convert the entire site (or about 10 seperately styled pages at least) from XHTML to HTML5, which sounds a nightmare as there are a load of CSS files and java functions in use, or is it more viable to somehow convert HTML5 code to work within an XHTML document?

    I won't go into too much else for now - I know it's a wacky sort of subject but any help or advice would be very much appreciated.

    Tommy

  2. #2
    Join Date
    Aug 2006
    Posts
    1,943
    You've got those two options, and a third would be to test the site on the particular browsers you care about, and see if it works ignoring the validation results.

    Dave

  3. #3
    Join Date
    Jul 2013
    Location
    Glasgow, Scotland
    Posts
    4
    Quote Originally Posted by tracknut View Post
    You've got those two options, and a third would be to test the site on the particular browsers you care about, and see if it works ignoring the validation results.

    Dave
    Mnay thanks for the reply Dave. The pages in question render fine in ie9 and FF6, all looks good so I suppose ignoring is certainly an idea but I would like to try and figure out how to re-write the HTML5 code that was pasted into the XHTML document in order to make the document pass validation. I imagine it involves altering the corresponding HTML5 style sheet and also changing HTML5 tags to XHTML tags wherever they may be.

    Knowing there are validation issues, such as incorrect mark up, would just annoy me too much, so i'll persevere down the route of altering the HTML5 code - how do i convert HTML5 code into XHTML ? I guess that's the question I need to figure out at the moment, and again, I would be extremely grateful for any help or advice regarding such. I really, really want this thing to validate!

    Tommy

  4. #4
    Join Date
    Aug 2006
    Posts
    1,943
    Keep in mind that html5 is a superset of x/html, so depending on what html5 features are used in the code, converting them backwards could be difficult. But if it's just that you've used things like <header> and <nav>, you should be able to replace those tags with appropriately styled <div> tags, and accomplish the task.

    Dave

  5. #5
    Join Date
    Jul 2013
    Location
    Glasgow, Scotland
    Posts
    4
    Thanks again Dave, i have tried adding the div tag to the <header> tag but i am a wee bit unsure of how to structure this particular syntax into XHTML syntax, daft, i know but i tried a few ways to no avail however - however i have begun changing a test page to HTML5 and am left with just 2 errors after fixing a bunch of others - the two remaining errors are telling me there is an unclosed elements -- Line 78, Column 9: End tag for body seen, but there were unclosed elements. </body>) -- and the other error is; Line 19, Column 26: Unclosed element div. <div id="wrapper_bg">

    Now, if i add a trailing slash, the HTML5 validation tells me to drop the trailing slash - as it is XHTML mark-up, thats understandable but i'm going round in circles I think...i think i will begin mass conversion to HTML5 probably if thats the way to go but i guess i am struggling with the syntax and structure of XHTML and HTML5, this is where the 'trial and error' method hits a brick wall but i think i'll be in better shape if i can learn some more - im just not finding this part so easy...

    Many thanks again,


    Tommy

  6. #6
    Join Date
    Jul 2013
    Location
    Glasgow, Scotland
    Posts
    4
    Quick update - i added a </div> tag near the bottom of the page (there are a couple of others there too) and all is working via the HTML5 validator

  7. #7
    Join Date
    Aug 2006
    Posts
    1,943
    Great!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles