michaellunsford Posted September 14, 2006 Share Posted September 14, 2006 Is anyone up on all the different versions of HTML?I've been writing to the HTML 4.01 Transitional spec (Dreamweaver MX's default) for as long as I can remember. What are the trends in this format? Should I begin transitioning to XHTML 1.0? Does it even matter? Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/ Share on other sites More sharing options...
ToonMariner Posted September 15, 2006 Share Posted September 15, 2006 I personnally design in xhtml 1.0 strict.there is not much difference between html 4 and xhtml 1 - as far as I have seen (not done any reading on this though!)One thing I have found is that it makes IE use the box model properly (or at least I have yet to see my sites break in ie!)Its just my opinion but I love the professionlism that xhtml strict or html 4 strict brings to your code. You HAVE to generate properly nested html and I like the idea that as a developer you have a framework to use and shoudl use it properly - after all if you right shoddy php with missing bits and bobs you get errors so why neglect something just because the odd browser is more forgiving....The concept of forwards compatible sites is something we should all be aware of - there are stories of BIG sites having to chop/hack/bodge things to get them to work for the largest audience they can afford to reach - save your self time money and and whole volume of other problems in the future....But thats just my take. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-92108 Share on other sites More sharing options...
michaellunsford Posted September 15, 2006 Author Share Posted September 15, 2006 Thanks for your opinion. I figured I should make the transition to xhtml -- it's just a tedious process. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-92120 Share on other sites More sharing options...
smashingred Posted September 18, 2006 Share Posted September 18, 2006 There is really no reason to switch to XHTML if you are using HTML 4.01 Trans but there are a million reasons to switch to a Strict Doctype. First, using transitional will force most browsers into quirks mode and therefore it will not necessarily render css the way it should based on the strict model. Strict will also force you to get presentational markup out of the html and into CSS where it belongs, it will make you have to drop font, b, i and all sorts of other presentational elements as well as presentational attributes such as align and target that are not supported and allow you to learn how to make more effiecient code. Using css for all presentation will enable presentation to be cached on the user's system so that only the HTML will need be rendered each time. I would also strongly suggest that you look into the differences in using XHTML and HTML as XHTML is not just about using self closing tags. Most people actually use XHTML when they don't even need to or know how and I was one who fell victim to the "trend" of the new. XHTML is a form of XML as HTML and not HTML per se. If you must use it you should do so knowing about W3C's Appendix C usage for XHTML served as "Text/HTML" versus "application/XML" I cannot say that one is right or one is wrong just that since I know the differences, I have moved back to HTML 4.01 Strict for all my own sites and only use XHTML when working with 3Party Applications (that probably use XHTML for the same reasons many people do which is that the spec is newer than that of HTML 4.01).Hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93890 Share on other sites More sharing options...
obsidian Posted September 18, 2006 Share Posted September 18, 2006 [quote author=smashingred link=topic=108069.msg436442#msg436442 date=1158580269]There is really no reason to switch to XHTML if you are using HTML 4.01 Trans[/quote]i would recommend you go ahead and make the switch to XHTML transitional if you're making the effort to really structure your pages anyway. if you are doing web work as a company or professional, there are more reasons to make the switch at a personal level that at the technical level. while i would agree that the average user couldn't tell the difference between an HTML4 page and an XHTML page, if you can add to your resume that you code in XHTML strict/transitional based on client preference, that is a [b]huge[/b] bonus in some cases. i would definitely recommend you take the time to make the switch. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93900 Share on other sites More sharing options...
smashingred Posted September 18, 2006 Share Posted September 18, 2006 obsidian, I don't really care if anyone uses XHMTL or HTML but why on earth would one "learn" to code in a transitional doctype. The purpose of transitional was to transition legacy pages and sites into the new without too many problems or to ensure that [b]if[/b] you [b]had[/b] to use deprecated elements or attributes that the pages would still validate for that doctype.If you are building new pages it makes sense to use the cleaner, strict code. The only reason most people code using transitional is because they don't know how or care to change the default doctype in Dreamweaver or GoLive. I do agree that one should know how to operate in all environments but Michael was asking which to use not which he should know. XHTML does not mean your code will be structured any better, it will just mean it will use a hybrid HTML/XML markup with the rigidity and requirements of XML. If you know how to write properly structured markup you will know how to do it in any doctype. BTW you can use the exact same markup/structure for HTML 4.01 as you do in XHTML 1.0 except you cannot have the closing slash in the head section of 4.01 documents as it will fail validation.Michael, I would say you should look at W3C recommendation for the use of Doctypes and become familiar with all of the current supported doctypes to be a valuable member of a team but if you are building pages from scratch for your own clients or work that you should seriously consider using strict doctypes no matter which as it will really make your life easier and your code cleaner.ATB,Jay Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93904 Share on other sites More sharing options...
obsidian Posted September 18, 2006 Share Posted September 18, 2006 [quote author=smashingred link=topic=108069.msg436456#msg436456 date=1158583428]obsidian, I don't really care if anyone uses XHMTL or HTML but why on earth would one "learn" to code in a transitional doctype. The purpose of transitional was to transition legacy pages and sites into the new without too many problems or to ensure that [b]if[/b] you [b]had[/b] to use deprecated elements or attributes that the pages would still validate for that doctype.[/quote]if you'll read the full post and take into account what i said, you may get a grasp on my recommendation. i'm not arguing that it's any better in practice to learn to code in transitional versus anything else. i'm simply making the point that many clients are looking for someone that can code their site to fit XHTML strict/transitional, so it's good to be able to do what their after so as not to limit yourself in work you can take. as you mentioned, [i]you can use the exact same markup/structure for HTML 4.01 as you do in XHTML 1.0 except you cannot have the closing slash in the head section of 4.01 documents[i], so what is there for him to learn anyway? i'm not recommending someone take the time to "learn" to code transitionally. i would, however, recommend someone to learn strict, which can then validate as transitional or strict based on the demand of the client. i would [b]never[/b] recommend for someone [b]not[/b] to expand their knowledge base, which seems like what you're trying to do. is it a necessity to learn? of course not. is it something that's worth knowing? of course.as for the question he initially asked ([i]which one to use?[/i]), i would recommend HTML 4.01 for someone not familiar with XHTML, too. it really is completely up to preference on personal pages or projects. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93916 Share on other sites More sharing options...
smashingred Posted September 18, 2006 Share Posted September 18, 2006 obsidian, I am sorry I missed your full meaning in your previous post. I guess that we are in agreement. 'Nuf said.ATB,Jay Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93943 Share on other sites More sharing options...
michaellunsford Posted September 18, 2006 Author Share Posted September 18, 2006 thanks for all the replies. From your posts, it would appear that the next logical step is the strict version of 4.question, though, I have poured over Dreamweaver MX2004 without finding any means to change the default doctype. The only recommendation I've found in google is to manually rewrite the doctype at the top of every page. This seems a bit backward to me. Is there a setting hiding in the recesses or dreamweaver?[b]EDIT[/b]: I found the configuration folder, where I can change the default doctype by modifying the default HTML document. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93956 Share on other sites More sharing options...
obsidian Posted September 18, 2006 Share Posted September 18, 2006 [quote author=smashingred link=topic=108069.msg436497#msg436497 date=1158587005]I guess that we are in agreement. 'Nuf said.[/quote]looks like we are ;) Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93960 Share on other sites More sharing options...
obsidian Posted September 18, 2006 Share Posted September 18, 2006 [quote author=michaellunsford link=topic=108069.msg436511#msg436511 date=1158588157]thanks for all the replies. From your posts, it would appear that the next logical step is the strict version of 4.question, though, I have poured over Dreamweaver MX2004 without finding any means to change the default doctype. The only recommendation I've found in google is to manually rewrite the doctype at the top of every page. This seems a bit backward to me. Is there a setting hiding in the recesses or dreamweaver?[/quote]when you create a new document (Ctrl + N), you are given a window that asks you what type of document you're wanting to create. in that window, you choose dynamic vs. static and the language in which you want to write your document. then, if i remember correctly, in the lower right corner, there is a select box that has the DTD options (None, 4.01 Trans, 4.01 Strict, XHTML Trans, etc). if, on that same window, you click on the "Preferences" button, you'll be able to set your default document type under the "New Document" settings. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93962 Share on other sites More sharing options...
michaellunsford Posted September 18, 2006 Author Share Posted September 18, 2006 Using MX2004 (7.0.1) -- the feature apparently doesn't exist in this version. I'm waiting for the new version to come out (sometime in '07, I believe) before forking out another $400 to upgrade.I did find the Default.html and other default document starting-points in the Configuration folder. that seems to be the only means of changing the default doctype in Dreamweaver 7. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93966 Share on other sites More sharing options...
michaellunsford Posted September 18, 2006 Author Share Posted September 18, 2006 Also smashingred mentioned that the "target" method is no longer supported. The W3C validator also doesn't like my "align" attribute -- making my very common [code=php:0]<table align="center">[/code] unusable, and text-align:center; doesn't do the same thing. Is there a transition document I can reference when trying to rewrite these tags? Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93977 Share on other sites More sharing options...
wildteen88 Posted September 18, 2006 Share Posted September 18, 2006 You'll want to warp your table inside a block level element if you want to center your table:[code]<div style="text-align: center"> <table border="1" cellpadding="2" cellspacing="1"> <tr> <td>Hello world</td> </tr> </table></div>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93982 Share on other sites More sharing options...
ToonMariner Posted September 18, 2006 Share Posted September 18, 2006 Or use css...table { margin: 0 auto;} Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93983 Share on other sites More sharing options...
wildteen88 Posted September 18, 2006 Share Posted September 18, 2006 [quote author=ToonMariner link=topic=108069.msg436541#msg436541 date=1158590504]Or use css...table { margin: 0 auto;}[/quote]That will fail in some browsers as you need to specify a width first, before the auto margins get calculated. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-93985 Share on other sites More sharing options...
michaellunsford Posted September 18, 2006 Author Share Posted September 18, 2006 I appreciate the quick fixes here, but I have tons of tags I need to redo. Since [b]target[/b] is no longer valid, how do you launch a new browser window in strict? javascript? Target has allowed me to skirt the popup blocker issue. Once the named window has been opened by target, onClick can reference it and set the parameters I need. Adding to this issue, what do I put in the href area if I want it to open in a new window? If I put anything, it will open it in the current window, then the onClick window.open method will open another window. Not putting a href parameter will cause the pointer to remain the arrow, and not give the familiar finger point that a traditional link does.PS> I can use margin:auto where my table has an assigned CSS width -- which has been the case lately. Thanks for the reminder. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-94002 Share on other sites More sharing options...
smashingred Posted September 18, 2006 Share Posted September 18, 2006 The attribute target will no longer validate because it is considered a hinderance to accessibility as it disables the back button and can cause other issues for people with special needs. The best method I have found is using an external javascript file that executes onload and getElementByTagName and give the "a" a class "external" this method beats using the javascript;; and href="#" because if the browser doesn't support javascript the link will click through and will just behave like a regular link because it is one: This article (http://www.sitepoint.com/article/standards-compliant-world) from SitePoint by Kevin Yank, provides one of the best and [s]most[/s] more accessible method to replace the target="_blank" method. All you have to do for your sites is install the script code and do a find and replace for the target="_blank" with rel="external" and you're done. And, as I said the link works if the person has Javascript off.You could easy modify this to handle popups but they may be detected as the it is loaded at the page load. For popups you should look into some of the DHTML and DOM/Javascript popups that don't use new windows but layered divs that mimic windows.Hope this helps,Jay Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-94058 Share on other sites More sharing options...
michaellunsford Posted September 18, 2006 Author Share Posted September 18, 2006 Okay, I've read the document smashingred provided. Basically, it's using javascript to write a target attribute to specific tags after the page has loaded. At the end of the day, it's still a target, just not one that will be caught by the validator.If a browser is complying with the strict version 4.01, will it allow javascript to write a non-existant parameter AND take that parameter into account when someone clicks the link? Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-94078 Share on other sites More sharing options...
smashingred Posted September 18, 2006 Share Posted September 18, 2006 [quote]If a browser is complying with the strict version 4.01, will it allow javascript to write a non-existant parameter AND take that parameter into account when someone clicks the link?[/quote]Yes. But keep in mind that in spirit, the document is no longer strict. In the standards based development community it is never recommended to open links in a new window as it breaks the linked document flow and as I said reduces accessibility. Too many business are of the 90s mindset that links out will lose visitors but this is foolish as if the content is worthy people know how to click the back button and will do so. Open a new window using target or some other method and you risk people thinking that the back button is disabled and will just close their browser. In the real world, it is not realistic to think that you will never need to open a new window on any client site so this solution just offers good compromise. And unlike almost any other method will still function if javascript is disabled. It also keeps the javascript out of the document body. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-94175 Share on other sites More sharing options...
michaellunsford Posted September 18, 2006 Author Share Posted September 18, 2006 [quote author=wildteen88 link=topic=108069.msg436538#msg436538 date=1158589688]You'll want to warp your table inside a block level element if you want to center your table:[code]<div style="text-align: center"> <table border="1" cellpadding="2" cellspacing="1"> <tr> <td>Hello world</td> </tr> </table></div>[/code][/quote]A note on this one. I have tried and it is not centering. If I give the DIV a border, it shows it going 100% horizontal, however, the inner content remains left justified. Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-94243 Share on other sites More sharing options...
smashingred Posted September 19, 2006 Share Posted September 19, 2006 Despite my personal objections to using tables for layout, you need to apply the centering to the table and not to the container. The following will work in almost every browser:[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Test</title></head><body><div><table style="border:1px solid #000; width:500px;margin:1px auto;"><tr><td>Hello World!</td></tr></table></div></body></html>[/code] It is important to note that this type of style should be called from a linked file and not in the HTML and may be represented as follows:[code]table{ width:500px; margin:1px auto; border:1px solid #000; }[/code]Also you MUST declare the doctype or when IE is thrown into quirks mode it will not render the table as centered.Now just so you know, there is no reason you can't use another div instead of a table to contain the page content. That being said, I am glad that you are making the move to better, more modern coding. All the best,Jay Quote Link to comment https://forums.phpfreaks.com/topic/20771-what-version-of-html/#findComment-94397 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.