Html 如何在css / html中以不同颜色打印每个字母
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38268573/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to print each letter in different color in css /html
提问by Tyrell
I want to print "google" in html page i.e(i want to print each letter in different color but all are in same line)For Example: google search engine contains "Google" letter like wise.
我想在 html 页面中打印“google”,即(我想用不同的颜色打印每个字母,但都在同一行)例如:谷歌搜索引擎包含“谷歌”字母。
Note:using HTML,CSS
注意:使用 HTML、CSS
回答by Cameron
Use spans
like this:
spans
像这样使用:
<p>
<span style='color: blue'>G</span>
<span style='color: red'>o</span>
<span style='color: yellow'>o</span>
<span style='color: blue'>g</span>
<span style='color: green'>l</span>
<span style='color: red'>e</span>
</p>
They are just like p
, h1
and etc, but they don't go to the next line.
它们就像p
,h1
等等,但它们不会转到下一行。
Also, be aware of Google's usage terms.
另外,请注意 Google 的使用条款。