Question

Title explains it all, please note I would just Google this but for some reason my computer is having a hard time connecting to the internet at the moment, so I had to write this on my phone with really awful web formatting.

EDIT: On a real computer now, to clarify I needed to set the text color of a string in an HTML document, preferably through CSS. Just something simple, like this:

<!DOCTYPE html> <body> The word <whatever styling here...>RED<end styling...> should be red! </body>

I wasn't able to try much at the time I posted this, since my computer was having internet trouble, so I didn't really know what to do.

Was it helpful?

Solution

Try this

 <span style="color: yourColor">your text</span>

OTHER TIPS

<p style="color:red;">pizza</p>

in html

p{
   color:red;
}

like that in css

for an inline style

<p style="color: blue"> text here </p>

if you want css with classes / ids ect.. put this in css file or in a script tag on your page:

.textColor
{
    color: blue;
}

then add the class to the element

<p class="textColor"> text here </p>

<p class="attention"></p> in your html

.attention{
   color:red;
}

in your css file, eg. my_styles.css which you include in the HEAD of your html, e.g.

<head>
    <link rel="stylesheet" type="text/css" href="my_styles.css">
</head>

The above is if attention will appear more than once. If it will never appear more than once you can use an id instead of a class, e.g.

<p id="attention"></p> in your html and

#attention{
   color:red;
}

in your css file

You can use this

<font color='red' >your text here</font>

By this you can set the desired color for us text . You can also use the hexadecimal format here .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top