CodeAve.com CodeAve.com - CSS - Text Display
ASP
JavaScript
CSS
·Basics
·Page Display
·Text Display
·Script Writers
·Contents
·What's New?
HTML
Maps
Links
Mail List
Search
Sitemap


 


Text Background Color
Just like a used textbook CSS enables you to place a background color or highlight behind text within a webpage. The behavior of the background color will depend on the tag you associate the background color command to. In this example we show backgrounds for the <span> and <p> tags, note that the <p> tag highlights the whole block and not just the specific text. Please note, most browser default settings come set to not display background colors when printed, so you’re highlight may "disappear" when printed.
View the Output
Text View
Print View
Mail this Link
Download the Code

<html>
<head>
<title>CodeAve.com/CSS - Text Background Color</title>
<style type="text/css">
<!--
p {background-color: #FFFF66}
/* Setting the paragraph tag with a background-color attribute
will change the background color of all the text between paragraph 
tags to another color (in this case yellow) */
-->
</style>

</head>

<body>
<p>
The background of the entire text field has been set to yellow
</p>

<br>
<!-- This ia an inline example of coloring 
the background of only selected text -->
The background of only <span style="background-color: #FFFF66">selected text</span> 
has been set to yellow


</body>
</html>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
Maps: Map Script Writers | Bing Maps | Google Maps
Privacy Statement

CodeAve.com is hosted by MyHosting.com
Donate Food Online with a Mouse Click at TheHungerSite.com
Donate Land Online with a Mouse Click at TheRainForestSite.com
© 1999 - 2013 CodeAve.com
All Rights Reserved