Ask coding questions

← Back to all posts
About Me
LittleNomster (113)

So im having some trouble with the challenge and i spent 30 minutes on google trying to figure it out yesterday. Can anybody help me make colored text boxes in html?

Answered by maazzubair99 (73) [earned 5 cycles]
View Answer
Comments
hotnewtop
maazzubair99 (73)

Could you link a repl or add a little detail? Are you trying to make text colored, or the background? What elements are you using for it?

LittleNomster (113)

@maazzubair99 im talking about making a text box filled white

maazzubair99 (73)

@LittleNomster you will have to put the text inside a <div></div> tag. So something like this:

<div id='randomDivId'>
   <p>Text</p>
</div>

And then in your css, you could do:

#randomDivId {
    background-color: white;
}

to make the background white

maazzubair99 (73)

@LittleNomster no problem. if it doesn't work let me know.

LittleNomster (113)

@maazzubair99 it worked thanks i wish i could mark two people

maazzubair99 (73)

@LittleNomster marking two people would be great
you could also change the id to whatever you like, it doesnt have to be randomDivId. Just remember to change the css too

KeaganLandfried (36)

If you are trying to change the color of the text, use:
<font color="insert_color">This is some text!</font>

However, if you are trying anything more, I suggest using a CSS file.

Please upvote and mark as answered if I answered your question. :)

LittleNomster (113)

@KeaganLandfried im new and dont think its possible to make a colored text box in css

mat1 (4381)

@KeaganLandfried <font> is deprecated and should never be used. Use CSS (style attr if you want it inline) instead.