Does W3C allow elements to be display:inline;?
Doing a code review, I noticed that a heading was using <span> tags
instead of headings, so I suggested using an <h4> tag, to gain the
semantic benefits. The context is a website footer, where there are
various lists of links under different headings.
<span>Category 1 Links</span>
<ul>
<li>Link 1 in the footer</li>
<li>Link 2 in the footer</li>
<li>Link 3 in the footer</li>
<li>Link 4 in the footer</li>
<li>Link 5 in the footer</li>
</ul>
The counterargument was that <h4> is a "block-level" element, whereas an
inline element was needed. Therefore he didn't think the element should be
changed. (And yes, he knows CSS and is familiar with the display: inline;
property.)
That sounds absolutely insane to me--goes against everything I always
thought was best practice: separation of content and presentation,
semantic web, the very purposes of HTML and CSS... yet in trying to
formulate a response, I came across this section in the HTML 4.01 spec:
Certain HTML elements that may appear in BODY are said to be "block-level"
while others are "inline" (also known as "text level").
...
Style sheets provide the means to specify the rendering of arbitrary
elements, including whether an element is rendered as block or inline. In
some cases, such as an inline style for list elements, this may be
appropriate, but generally speaking, authors are discouraged from
overriding the conventional interpretation of HTML elements in this way.
The alteration of the traditional presentation idioms for block level and
inline elements also has an impact on the bidirectional text algorithm.
See the section on the effect of style sheets on bidirectionality for more
information.
So here is the question: does this section make the issue sufficiently
vague for there to be valid difference of opinion here, or is it (as I had
thought) pretty clear in one way or the other? If this section is open to
interpretation, are there any other W3C guidelines that are more concrete?
I don't want to get into opinions on this, I just want to make sure I'm
understanding the spec and the W3C guidelines correctly: is there true
ambiguity here, or not?
No comments:
Post a Comment