2

I am wondering about the following questions for HTML5

  1. <br /> OR <br>? Are all elements the same for the answer?
  2. selected="selected" OR selected?
  3. Are there any other syntax instances that were true for XHTML/HTML4 that are not for HTML5?
Metropolis
  • 217
  • 2
  • 9

1 Answers1

3
  1. <br> in HTML5 <br /> in XHTML5

  2. selected, selected="", and selected="selected" are all valid attributes

  3. Differences between HTML 4 and 5. - From StackOverflow.

John Conde
  • 86,255
  • 27
  • 146
  • 241
  • Ah cool, why is w3cschools still using
    and etc...then?
    – Metropolis Oct 27 '10 at 02:57
  • I already read over that entire page about the difference between HTML4 and 5, but I never saw where it said the correct way to do this in HTML5? – Metropolis Oct 27 '10 at 02:58
  • Has using selected/checked/disabled without specifying a value ever been valid? – Lèse majesté Oct 27 '10 at 02:59
  • @Lèse majesté - I believe in early versions of HTML and the transitional version of HTML 4 you could use them without specifying a value. – John Conde Oct 27 '10 at 03:01
  • @Metropolis - I didn't look through the entire w3c site so I may be missing something but it looks like they are only showing xhtml 5 syntax. Since html5 also comes with an xml compatible xhtml 5 version they really should be showing both or at least explain there is both. – John Conde Oct 27 '10 at 03:03
  • @John Conde: Sorry John, I am just trying to pinpoint exactly where in the specification these things are before I believe anyone, Not that I think you are wrong :p, I just want to get it right the first time since I have been doing
    for a long time now while using XHTML.
    – Metropolis Oct 27 '10 at 03:04
  • I really hope they drastically change HTML5 just to make everyone do a double-take. It's not done yet. – Jeremy L Oct 27 '10 at 03:06
  • @Metropolis - see wikipedia – John Conde Oct 27 '10 at 03:06
  • @Nerdling: Yes, but many of the HTML5 specs are already implemented in Chrome, Safari, and Opera....Do you really think they will just throw their arms up one day and tell those companies they need to change their browser again? lol..... – Metropolis Oct 27 '10 at 03:07
  • @John Conde: Yes, in XHTML it should be
    ....I knew that. But that wiki page does not say what the answer is for HTML5. I have really not seen a page that does yet. And it appears as though
    passes the HTML5 validator. So I am confused.
    – Metropolis Oct 27 '10 at 03:12
  • In HTML tags like <img> and <br> do not require a closing tag or />. In XHTML they do. This is regardless of version. – John Conde Oct 27 '10 at 03:18
  • 1
    @John: I've always assumed the shorthand was invalid, which is why I specify a value in all of my code. But upon closer inspection of the current revision of the HTML5 specs, it looks like it might actually be valid. They don't explicitly say it anywhere, but in the example code they always use readonly without a value, and while selected is given a value in most places, they use the shorthand here (scroll down a bit): http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#attr-option-disabled – Lèse majesté Oct 27 '10 at 03:21
  • 2
    @Lèse majesté - Good link. [here's a great example from that page] that shows exactly what we need to know.(http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#boolean-attribute) Going to update my answer accordingly. – John Conde Oct 27 '10 at 03:24
  • @Lese majeste: Thats why I have been getting confused. I have been seeing them used interchangeably. I even watched a video on Youtube of Ian Hicks showing off HTML5 and he was using things like "selected" instead of "selected=selected" – Metropolis Oct 27 '10 at 03:33