E-mail List Archives

Re: Use of SAMP to highlight search results

for

From: Jukka K. Korpela
Date: Oct 28, 2010 1:18PM


Patrick H. Lauke wrote:

> I'd say the "mark" element sounds more appropriate

Within HTML5, yes. But HTML5 is an incomplete draft, or set of drafts,
expected to be finalized maybe around year 2020. Moreover, the MARK element
does not imply any particular rendering or other processing, in the browsers
that recognize it. It's a bad idea, if you ask me, to define an element for
a certain kind of emphasis without saying that it should be rendered
emphatically - the idea seems to be that authors will style it, naturally
routinely ignoring non-visual browsing, among other things.

But enough of this - MARK surely would not improve usability.

The way to emphasize text in a manner that maximizes the odds of making
different browsers highlight it somehow is to use the STRONG element.

The OP wrote:

>> On the face of it, SAMP sounds like it might be a better element to
>> use than EM, which is how I currently highlight matching text in
>> search results.

Using EM is not a good practical choice, since in practice it means italic
text in most browsers, and most pages use some sans-serif font. In such
fonts, italic text is not particularly highlighted - it differs too little
from normal text. So I would use STRONG, which is normally rendered in bold,
and I might throw in some style sheet that uses e.g. yellow background for
STRONG, e.g.
strong { background: #ffd; color: black; padding: 0 0.05em; }

>> What do you think? Does this sound like a good alternative, or
>> should I be using a different element entirely to EM or SAMP?

The SAMP element is rarely used on web pages, and it's not particularly
useful. It is meant to be used for computer output, though some early
interpretations say that it could also be used for "sample texts", like
words presented as objects of discussion rather than used normally. Browsers
generally render SAMP in monospace font by default. Some translation
software treats SAMP as indicating that its content is to be treated
literally, invariant in translation. So SAMP is mostly an oddity.

--
Yucca, http://www.cs.tut.fi/~jkorpela/