Search code examples
htmlsemantic-markup

What tag should be used for specific values in a generic message (e.g. "Do you want to delete <tag>ABC</tag>?")?


Let's say I have a generic message, such as

Do you want to delete {object} from {environment}?

I want to emphasise non-generic parts (object/environment).
Currently I use <em>, but it is missing any semantics over why this is emphasised, so the emphasis becomes more stylistic than semantic.

Is there a better choice — some tag where this is defined as explicit use case?


Solution

  • I think the b element is appropriate here.

    It is for "text to which attention is being drawn", "without conveying any extra importance and with no implication of an alternate voice or mood".

    I don’t think the strong element is appropriate; it might be for the whole warning, but not specifically for the name of the thing that gets deleted. And neither is the em element, as there is no emphasis involved.

    In some cases, depending on the actual content, elements like abbr, a and cite might be used, too, but this would be in addition, not as alternative.