Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spanned CSS style/color

Is there any way to use spanned colors directly from a string without using any Java/Kotlin code?
For example to bold text I can use "<b> $someString </b>"
But what is the way to change color? I searched it in Android Documentation and I found this.

CSS style: <span style=”color|background_color|text-decoration”>

But I don't get it how to set it, I tried to do it in many ways e.g.
"<span style=#999999|#999999|#999999> $someString </span>"
But it didn't work.

like image 519
iknow Avatar asked Jul 06 '20 16:07

iknow


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.

Can we apply CSS on span?

The <span> tag is an inline container used to mark up a part of a text, or a part of a document. The <span> tag is easily styled by CSS or manipulated with JavaScript using the class or id attribute. The <span> tag is much like the <div> element, but <div> is a block-level element and <span> is an inline element.


1 Answers

The character | means or.

In the documentation you see <span style=”color|background_color|text-decoration”>

Which means it can be any of <span style="color:#999999"> $someString </span>

Or <span style="background-color:#999999"> $someString </span>

Or <span style="text-decoration:underline"> $someString </span>

like image 54
M D P Avatar answered Oct 18 '22 19:10

M D P