Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text background color

Status
Not open for further replies.

ryanbrand

Programmer
Oct 28, 2003
22
US
Hi, I'm looking for a way to give my text a background color that is different from the background color of the page.

I want to do it using simple html and not CSS (or inline styles). I want to be able to have a white background, but have the text with a red background.

Thank you for your help.

Ryan
 
Uh, you havta use CSS otherwise, put your text in a table with 0 borders and a background color.

And you should learn CSS, many "HTML" characteristics are now deprecated (ie bold ) and are incorporated into CSS.
 
And even using background color in table cell is deprecated if you use the html attribute. CSS and HTML walk hand in hand and if you want to use one efficiently you'll need to learn the other. This is how you'd solve it in CSS:

Text text <span style=&quot;background: red;&quot;>text with red background</span> normal text again.

You can apply similar background to most of the elements, if you are looking for a block-based solution (<div>) rather than an inline one (<span>).
 
Would suggest using tables, easiest way to do is

<body bgcolor=&quot;#000000&quot; text=&quot;#FFFFFF&quot;>
<div align=&quot;center&quot;><center>

<table dir=&quot;ltr&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;
bgcolor=&quot;#FF0000&quot;>
<tr>
<td>Hey I hope this Helps just put your text in here</td>
</tr>
</table>
</center></div>
</body>
</html>



Chang the colors and text to read to what you want
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top