Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML/CSS font color vs span style

Tags:

html

css

What should I use?

<span style="color:red">test</span> 

or

<font color="red">test</font> 

and why?

like image 827
Isis Avatar asked Nov 15 '10 08:11

Isis


People also ask

How do I change text color in HTML span tag?

You have to use CSS. Go with the <span> tag, or a separate style sheet. According to its specification, the <span> tag has no semantic meaning and just allows you to change the style of a particular region.

Is it good to use SPAN in HTML?

div in HTML. Span and div are both generic HTML elements that group together related parts of a web page. However, they serve different functions. A div element is used for block-level organization and styling of page elements, whereas a span element is used for inline organization and styling.

What is the difference between CSS color and font size?

The CSS color property defines the text color to be used. The CSS font-family property defines the font to be used. The CSS font-size property defines the text size to be used. Use of CSS color, font-family and font-size properties: The CSS border property defines a border around an HTML element.

How do I change the style of a span in HTML?

You have to use CSS. Go with the <span> tag, or a separate style sheet. According to its specification, the <span> tag has no semantic meaning and just allows you to change the style of a particular region.

What is the difference between <span> and <div> in HTML?

The <span> tag is much like the <div> element, but <div> is a block-level element and <span> is an inline element. The <span> tag also supports the Global Attributes in HTML. The <span> tag also supports the Event Attributes in HTML.

What is HTML styles in CSS?

HTML. Styles - CSS. CSS stands for Cascading Style Sheets. CSS saves a lot of work. It can control the layout of multiple web pages all at once.


1 Answers

You should use <span>, because as specified by the spec, <font> has been deprecated and probably won't display as you intend.

like image 71
Kyle Avatar answered Sep 28 '22 11:09

Kyle