Answer the question
In order to leave comments, you need to log in
Which tags are kosher: em or i, strong or b?
There are HTML tags that are meant to (sort of) do the same thing and render the same way. For example pairs em and i, strong and b.
What formatting tags are “more correct” to use (where formatting with tags is appropriate - for example, when creating topics / comments here on Habré, on StackOverflow, etc.)?
I'm leaning towards em/strong myself. they are more, so to speak, semantic. On the other hand, i/b seems to be more concise.
Answer the question
In order to leave comments, you need to log in
In the W3C specification, the EM and STRONG tags are moved to the Structured Text -> Phrase Elements section.
EM: Indicates emphasis.
STRONG: Indicates stronger emphasis.
The appearance of how phrase elements will be displayed is determined by the browser. These tags can be taken into account, for example, by Text-to-Speech engines to change the intonation or volume of the voice.
At the same time, B and I refer to the Formatting -> Fonts section and give an explicit indication to the browser what font to render the fragment in.
I: Renders as italic text style.
B: Renders as bold text style.
i / b - only visual design, do not carry a semantic load, sort of.
In html5 it's about the same. The tags and have been redefined so that - subtle selection, - strong selection.
EM is for intonation stress. In the English tradition, such passages are italicized. In Russian, it is not customary to do this, and intonation stress is distinguished by the context, the construction of the sentence. Therefore, this tag is inappropriate for the layout of Russian texts.
STRONG is intended for semantic emphasis. And everything else (of the above), in my opinion, is from the evil one.
In HTML 4, this difference seems to me to be implied, but poorly expressed. But in HTML 5 it is very clear: stress emphasis (evaluate the examples!) and strong importance .
I use i and b for design decisions when using only CSS is inappropriate (for example, navigation, image captions, etc. - why select in a span that should be assigned bold, if you can select in b?), and strong and em mostly page content to highlight part of a phrase/paragraph/…
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question