Taylor Lopez Taylor Lopez - 6 months ago 30
CSS Question

Best replacement for font tag in html

Since the "font" tag in HTML is being deprecated in HTML5 (and I understand why)
is there a clean solution to applying certain attributes and styles to only portions of a paragraph text? I'm using Javascript to parse an XML file that relies on the fact that the "font" tag allows portions of wrapping text to be formatted using class-based CSS. I realize the "anchor" ('a') tag could also be used for this purpose, but that way seems very backwards and unnatural.


The span tag would be the best way.

Although inline CSS is typically not recommended, here is an example:

This is my <span style="font-weight:bold">paragraph</span>.

span and div are similar, but the div tag is a block element, so it will cause line-breaks. span is an inline tag that can be used inline with your text.