Reputation: 13334
When I want to emphasize or discuss a word that is related to computer code inside a block of normal text, I use the <code>
tag. For example:
If you set the variable
foo
to the value'bar'
, then something will happen. If you setfoo
to any other value, then nothing that's any good will happen.
What is the best semantic HTML5 tag to use to emphasize or discuss a word that is not related to computer code? The way I am thinking of this, it would be (or could be) styled like <code>
but not monospace. For example:
The word math is a shortened version of the word mathematics, which has its root in some ancient language that I am not going to research right now.
Upvotes: 1
Views: 424
Reputation: 13334
I just found the updated meaning of the <i>
tag for HTML5. From MDN:
The HTML
<i>
element represents a range of text that is set off from the normal text for some reason. Some examples include technical terms, foreign language phrases, or fictional character thoughts. It is typically displayed in italic type:Musa is one of two or three genera in the family Musaceae; it includes bananas and plantains.
It is a good idea to use the
class
attribute to identify why the element is being used, so that if the presentation needs to change at a later date, it can be done selectively with style sheets.
So, this is what I am going to do for this case... <i class="example">
or similar.
Upvotes: 0
Reputation: 2564
If you're looking for the tag indicates that its content is being referenced / used as an object for discussion
you can use <dfn>
tag. According to MDN:
The HTML Definition element (<dfn>) is used to indicate the term being defined within the context of a definition phrase or sentence.
Upvotes: 1