What is the best practice for multiple colors in a sentence in HTML/CSS? -
i know want keep style , content separate, assuming want display:
<h1>roygbv</h1>
on page, each letter matching color, best practice this?
would be:
<h1><font color="red">r</font><font color="orange">o</font>
and on? , assuming have multiple words in paragraph needed colored like:
sally found red seashells down blue seashore out in yellow sun ...
is ok have font tags on html? alternative can think of putting them in span tags , adding class. allow me change definition of red in css file iterations of red.
<font>
tag deprecated. mdn docs
best way in question itself. using span wrap particular word.
.red { color: red; } .blue { color: blue; } .yellow { color: yellow; }
<p>sally found <span class="red">red</span> seashells down <span class="blue">blue</span> seashore out in <span class="yellow">yellow</span> sun ...</p>
Comments
Post a Comment