Highlighting text on a page using CSS

By: Emiley J. Emailed: 1605 times Printed: 2078 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

With CSS you can highlight text on a page, making it look like you ran a yellow highlight marker over it. This is great for emphasizing important words or points. 

Just add this code to the HEAD section of your HTML page: 

<style type="text/css"> 
<!-- 

.HL {background: #ffff99; 
color: #000000;} 

--> 
</style> 

What you've done is create a CSS class, and now the table is set. To use it to highlight a passage, you could write: 

<font class="HL">this is highlighted</font>

The words "this is highlighted" will have a yellow background with black text. Of course, you can change those colors to anything you want by modifying the colors in the CSS code. 

Let's not stop there. OK? What about if we wanted to highlight an entire paragraph? If you don't like messing with tables, try this style tag: 

<P style="background-color: FEE333";> 

All of the text in the above paragraph will be highlighted in yellow-orange. To change that color, just substitute any other hex code or use a color name. 

This CSS tag works in both Netscape and Internet Explorer. 


Javascript Home | All Javascript Tutorials | Latest Javascript Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(1)


1. View Comment

thxs

View Tutorial          By: uhhhhh........... at 2009-01-19 06:55:59

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Emiley J.
Error generating R.java from manifest
ERROR 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client
IIS and Tomcat - how to configure to work together
PHP Warning: Unknown(): Unable to load dynamic library '/usr/local/php4/lib/php/extensions/no-debug ......
Adding your own Application icon for your J2ME application (jar file)
Creating Menus in Code using VB.net
Traversing all files in a directory using Ruby
Using Proxy to connect to URLs in Ruby
POST a form in Ruby
Reading URL content using Ruby (HTTP)
dRuby client/server mode sample program
Benchmark module in Ruby
encoding and decoding in Ruby using Base64 Module
Module Abbrev in Ruby
Standard Library Packages in Ruby

More Tutorials in Javascript
Use WinSCP to transfer log files remotely using Javascript
Verifying user input in JavaScript
Pause execution in JavaScript
Javascript to display client date and time on webpage
Getting Browser's height and width using Javascript
Highlighting text on a page using CSS
Using revealTrans to do page transitions in Javascript
Password protect a web page using Javascript
Diabling Right Click option in a browser using Javascript
Scrolling message on the status bar using Javascript
window.frames[i] in Javascript
Form validation using Javascript
Using && in Javascript
The if statement in Javascript
do-while, while, for and for-in loops in Javascript

More Latest News
Most Viewed Articles (in Javascript )
Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers
Show how many characters remaining in a html text box using javascript
History and evolution of Javascript
List of Keywords and reverved words in Javascript
Using toString() in JavaScript to convert data types to String
Using ! and !! in Javascript
window.frames[i] in Javascript
Highlighting text on a page using CSS
Password protect a web page using Javascript
Getting Browser's height and width using Javascript
Javascript Basics
do-while, while, for and for-in loops in Javascript
break and continue in Javascript
Form validation using Javascript
Using revealTrans to do page transitions in Javascript
Most Emailed Articles (in Javascript)
Getting Browser's height and width using Javascript
Click to remove an element from a select html form using javascript
List of Keywords and reverved words in Javascript
Javascript to display client date and time on webpage
Show how many characters remaining in a html text box using javascript
History and evolution of Javascript
Javascript Basics
Using ! and !! in Javascript
do-while, while, for and for-in loops in Javascript
switch in Javascript
this keyword sample in Javascript
window.frames[i] in Javascript
Use WinSCP to transfer log files remotely using Javascript
Using parseInt() and parseFloat() in JavaScript to convert data types to Numbers
Typecasting in Javascript