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 abbr
attribute, 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.)