简体   繁体   中英

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM