Jump to content

What Is Correct Tag To Use To Change Fonts?


limitphp

Recommended Posts

If I have a section of text in a table or div, or something else, and I just want to change the font color of one word in the text, what is the correct tag to use to change the font color? I understand I should use the style='color:', but what tag is the most appropriate for this?

Link to comment
Share on other sites

<font color="blah">word</font>

 

No, <font> has been deprecated for a while, and is no longer valid in html5.

 

@limitphp You should use CSS to apply the font you need to the element containing your text.  The element you use should be sematic for whatever the text represents/means on the page.  If you need a generic element to wrap a small bit of text, use <span> or <div> depending on if you need inline or block level elements.

Edited by kicken
Link to comment
Share on other sites

No, <font> has been deprecated for a while, and is no longer valid in html5.

 

@limitphp You should use CSS to apply the font you need to the element containing your text. The element you use should be sematic for whatever the text represents/means on the page. If you need a generic element to wrap a small bit of text, use <span> or <div> depending on if you need inline or block level elements.

 

Div would knock the text after it down on the next line, unless I added some style properties to the div. So, perhaps span is the best tag to use to change the font of one word in a section of text?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.