0

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?

Andrey Shchekin
  • 21,101
  • 19
  • 94
  • 162

2 Answers2

1

You could go with the strong tag. The strong tag indicates strong importance for the enclosed text. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong

BurningLights
  • 2,387
  • 1
  • 15
  • 22
  • 1
    Hmm, based on that page it does seem a better choice than ``, however the examples with "danger" etc seem overly strong for what I need. Seems like with `` I should emphasise "delete", not what I am deleting. – Andrey Shchekin Jul 03 '15 at 01:07
  • Yeah, it does seem like it could be a little strong. For reference, here's the complete list of text-level semantics tags you can use, from the W3C reference: https://docs.webplatform.org/wiki/html/elements#Text-level_semantics. – BurningLights Jul 03 '15 at 01:29
1

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.

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360