Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Ithaca
    Posts
    68
    Rep Power
    2

    How to use HTML4 legacy attributes in a HTML5 document?


    Well I was wondering though... I like to make use of the vast new features and attributes introduced in HTML5, but there are some attributes from HTML4 become unavailable. Two very important elements are frameset and table's attributes. Is there a way to define the html document as HTML5 while still maintaining the availability of some legacy HTML4 attributes? Please lemme know if thats possible.
  2. #2
  3. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    The <frameset> element is obsolete. They are not user friendly. While I don't recommend it, you could use an HTML 4 frameset document to show HTML5 documents in the various frames.

    As for attributes of the <table> element, as the specs say, use CSS instead.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Ithaca
    Posts
    68
    Rep Power
    2
    Originally Posted by Kravvitz
    The <frameset> element is obsolete. They are not user friendly. While I don't recommend it, you could use an HTML 4 frameset document to show HTML5 documents in the various frames.

    As for attributes of the <table> element, as the specs say, use CSS instead.
    Umm then how is that possible? Can you show me how I can use HTML5 features while keeping some HTML4 obsolete elements? Do I have to write some kind of code in the html tag to enable html4 or html5 compatibility?

    And for table elements, the css does not cover up for all the obsoleted properties. For instance, the attribute cellpading and cellspacing are nowhere to be found. Id rather use table attributes, these are easier for me.
  6. #4
  7. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    And for table elements, the css does not cover up for all the obsoleted properties. For instance, the attribute cellpading and cellspacing are nowhere to be found.
    The CSS properties are named a little differently from the HTML attributes, but they do certainly exist. For the "cellpadding" attribute, you simply set the CSS "padding" property for <td> and <th> elements in the table instead of applying it at the <table> element. For the "cellspacing" attribute, the CSS "border-spacing" and "border-collapse" properties offer more control. (I should mention that IE7 doesn't support border-spacing though.)

    Id rather use table attributes, these are easier for me.
    So you're willing to learn some HTML5 which is still in development, but you don't want to learn more CSS2.1 which is an established standard?
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Ithaca
    Posts
    68
    Rep Power
    2
    Originally Posted by Kravvitz
    The CSS properties are named a little differently from the HTML attributes, but they do certainly exist. For the "cellpadding" attribute, you simply set the CSS "padding" property for <td> and <th> elements in the table instead of applying it at the <table> element. For the "cellspacing" attribute, the CSS "border-spacing" and "border-collapse" properties offer more control. (I should mention that IE7 doesn't support border-spacing though.)


    So you're willing to learn some HTML5 which is still in development, but you don't want to learn more CSS2.1 which is an established standard?
    I see, I do notice that they are named somewhat different. If you dont mind, can you please give me a list of equivalent css attributes to all old table properties that become obsolete? Id really appreciate this, thx. Heres a list of HTML4 elements that are not longer supported in HTML5:
    http://www.w3schools.com/tags/tag_table.asp
    http://www.w3schools.com/tags/tag_tr.asp
    http://www.w3schools.com/tags/tag_td.asp

    Well I am a PHP programmer with knowledge of HTML, never really learned CSS before so its definitely easier for me to get used to HTML5 than to use CSS. But of course, I dont mind learning new things. I dont know javascript a year ago, now I am pretty comfortable with pure javascript(though still struggling to write both php and javascript together lol, I aint good at that.)
  10. #6
  11. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,911
    Rep Power
    1045
    Hi,

    instead of trying to preserve your old table layouts in HTML5, you should drop them completely, take a few days to learn CSS and then make a proper layout with pure CSS.

    I'm surprised that you even use table layouts. It thought this had died off 10 years ago. Websites today tend to follow the principle of the semantic web. That is, HTML is used to structure the content of a website, all design stuff is done with CSS. So no more <blink>, no more <font> -- and no more table layouts.

    I mean, sure, you can still misuse tables for layouting to a certain degree. But don't you find it rather odd that you use the newest technology (HTML5), while the website itself uses practices from the 90s?

    By the way: Don't use that w3schools as a reference. It's known to be a sh*tty resource with a lot of nonsense and obsolete information (maybe that's where you got the tables from?). The best source is the W3C itself (as linked by Kravvitz).
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Ithaca
    Posts
    68
    Rep Power
    2
    Well I mostly only worry about the back-end PHP programming, I only learned HTML when it was still HTML4 so I aint really kept up with the new stuff. But anyway I was wondering though, what exactly is HTML4.01 transitional? It looks like something like this:

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
    If I use HTML4.01 transitional type document, will it support new HTML5 attributes? If not, there is really no way to use both HTML5 and HTML4 legacy attributes altogether?
  14. #8
  15. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    Here's a good list of the CSS2.1 counterparts for the old presentational HTML attributes.

    Originally Posted by Hall of Famer
    what exactly is HTML4.01 transitional?
    If you look in the DTD column of the tables of HTML4 elements and HTML4 attributes, you'll see all the things that are allowed in Transitional (designated with an "L" for "loose") that aren't allowed in Strict.

    Originally Posted by Hall of Famer
    If I use HTML4.01 transitional type document, will it support new HTML5 attributes?
    It will not validate, but browsers should support them (or not support them, as the case may be) regardless of the doctype.
    Last edited by Kravvitz; December 11th, 2012 at 11:10 PM.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Ithaca
    Posts
    68
    Rep Power
    2
    Originally Posted by Kravvitz
    Here's a good list of the CSS2.1 counterparts for the old presentational HTML attributes.


    If you look in the DTD column of the tables of HTML4 elements and HTML4 attributes, you'll see all the things that are allowed in Transitional (designated with an "L" for "loose") that aren't allowed in Strict.


    It will not validate, but browsers should support them (or not support them, as the case may be) regardless of the doctype.
    I see, so using HTML5 elements in a HTML4 transitional will work? Thats good, I love to take advantage of what HTML5 has to offer but aint ready to give up on some awesome features from HTML4 yet, such as framesets. XD
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Location
    India
    Posts
    3
    Rep Power
    0
    Nice thing you have shared here which is really very helpful and I think it will help to many other people who do not know it.
  20. #11
  21. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    Originally Posted by cygnetinfotech
    W3schools is quite useful resource to new bees. It helps alot in understanding basic things and also to developers in order to design proper layouts.
    Welcome to DevShed Forums, cygnetinfotech.

    Please don't recommend w3schools.com. I recommend you check this out: W3Fools: A W3Schools Intervention
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Ithaca
    Posts
    68
    Rep Power
    2
    Originally Posted by Kravvitz
    Welcome to DevShed Forums, cygnetinfotech.

    Please don't recommend w3schools.com. I recommend you check this out: W3Fools: A W3Schools Intervention
    Well this is a bot, not human lol.
  24. #13
  25. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    Originally Posted by Hall of Famer
    Well this is a bot, not human lol.
    How can you be sure?
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Location
    Ithaca
    Posts
    68
    Rep Power
    2
    Originally Posted by Kravvitz
    How can you be sure?
    Dont you see that some users who only have like 1-3 posts but talk in the same patterns/tones? It suggests that they aint human, but spambots programmed to make forum posts in a specified manner.
  28. #15
  29. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    Originally Posted by Hall of Famer
    Dont you see that some users who only have like 1-3 posts but talk in the same patterns/tones? It suggests that they aint human, but spambots programmed to make forum posts in a specified manner.
    Yes, but they could also be a noob from somewhere like India or Ukraine. As much as I might like to, I can't delete posts merely on the suspicion of being from a spam-bot.
    Spreading knowledge, one newbie at a time.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo