1

Some years ago, I was using

<th abbr="Short header">A somewhat long header</th>

This was causing the long content to be displayed on wide displays, while the short content was displayed (instead of wrapping the cell) if the display was too narrow. And all that without any javascript. I cannot tell anymore on which browser I had tested this though.

Now, it looks like abbr attribute on th is abandoned in html5. (And does no more seems to work as I was expecting, at least on th elements. Tested with Chrome 41 with some tinkering on css to try triggering a short display.) Mdn states to use title instead, or abbr element. But both do always display the short content whatever space is available.

I have searched for other html alternates to this html4 functionality, but found none.

Is there any full replacement element/attribute to the old html4 abbr attribute on table cells?

Here is some excerpts of the Html4 spec for old abbrattribute, emphasis by me:

This attribute should be used to provide an abbreviated form of the cell's content, and may be rendered by user agents when appropriate in place of the cell's content.

...

User agents must render either the contents of the cell or the value of the abbr attribute. For visual media, the latter may be appropriate when there is insufficient space to render the full contents of the cell.

Yes, this is quite vague about when abbr value should be used instead of cell content. Maybe that is the reason for this functionality to be fully dropped. But I have not found any discussion on reasons for dismissing abbr attribute.

(To add to the confusion, the th html5 spec still defines abbr attribute on th for another usage, though it is written obsolete in the previously linked w3c reference page.)

Frédéric
  • 9,364
  • 3
  • 62
  • 112
  • I have also seen http://stackoverflow.com/q/23883142/1178314, which is about `td`, not `th`. `abbr` attribute was not supposed to be used on `td` in html4 spec. (But be careful when reading it, it is not obvious from the start of relevant section.) – Frédéric Apr 20 '15 at 15:49
  • 1
    The linked [w3c HTML5 reference page is itself obsolete](http://www.w3.org/TR/html-markup/Overview.html#abstract). As you rightly observe, the HTML5 recommendation does indeed include the attribute. – Alohci Apr 20 '15 at 23:47
  • Right, I had not spotted that, thanks. The replacement reference documentation is currently "not ready" https://docs.webplatform.org/wiki/html/elements/th. So I have to do with spec only. Which for my case give no html alternative for the functionality I am looking for. I guess I just have to forget about that ^^. – Frédéric Apr 21 '15 at 07:48

0 Answers0