1. 50

  2. 7

    Thank you for taking the time to go back and learn how to write HTML properly. For the sake of accessibility, I wish we could somehow force all professional web developers to do this. But the W3C tried strict XHTML, and that ship has sailed.

    1. 6

      There are a few elements that seem redundant. The legend element represents a caption for a fieldset element, the caption element represents a caption for a table element, and the figcaption element represents a caption for a figure element. I don’t know why one element couldn’t do the job for all three, since the meaning could be derived from the parent element.

      Now I’m curious, too. Is it an ambiguity thing? A historical thing? Does HTML have any elements that derive meaning from their parent?

      1. 18

        Does HTML have any elements that derive meaning from their parent?

        <li> changes when it’s in a <ul> vs <ol>. At least to me, “list-item that has order” and “list-item that lacks order” seem like different meanings.

        1. 4

          Oh duh yeah that’s a perfect example I didn’t think of

          1. 3

            Isn’t order the property of the container?

            1. 1

              Maybe that’s how the designers of HTML thought about it? But that property is displayed by changing how the items appear (numbers vs bullets). When I’m reading a web page or editing a Google doc, it feels like the individual items are either bullets or numbered steps.

              1. 3

                How things are displayed is a matter of style, and the style cascades through all children elements.

                For example to style an ordered list so it uses roman numerals, you add list-style:upper-roman to the <ol>, not to each <li>.

          2. 3

            summary is also caption for details. all captions are equivalent to an h1 ina section around the item. img/picture/video/iframe vs object redunancy, etc

            1. 3

              Unsure about figcaption.

              But for legend and caption, there was one perhaps-subtle difference in HTML 4: legend, as a form element, supported the accesskey attribute, while caption did not. Different attribute lists, different elements.

              As of HTML5 I believe they also have different permitted content, but in HTML 4 they both allowed any %inline content.