467,910 Members | 1,738 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,910 developers. It's quick & easy.

Underlining text using CSS

Hi, I am new to the forum.

I wanted to know if there's any way in which I can underline a phrase in a webpage using CSS. I tried using "text-decoration:underline;" but it looks like that works only with hyperlinks. Any suggestions/advice is greatly appreciated.

Thanks...
Mar 30 '07 #1
  • viewed: 1196
Share:
3 Replies
Expert 1GB
Hi, I am new to the forum.

I wanted to know if there's any way in which I can underline a phrase in a webpage using CSS. I tried using "text-decoration:underline;" but it looks like that works only with hyperlinks. Any suggestions/advice is greatly appreciated.

Thanks...
That is the correct syntax.
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2.     <html>
  3.         <head>
  4.             <title>Coming...</title>
  5.                 <style type="text/css">
  6.                 .clsUnderline
  7.                 {
  8.                  text-decoration: underline
  9.         }   
  10.                 </style>
  11.         </head>
  12.             <body>
  13.                <div class="clsUnderline">
  14.                     TEXT TEXT TEXT TEXT TEXT TEXT 
  15.                </div>
  16.             </body>
  17. </html>
  18.  
Mar 30 '07 #2
KevinADC
Expert 2GB
It should work for just about any text:

<h1 style="text-decoration: underline">hello world</h1>
<div style="text-decoration: underline">the text in the div</div>
etc
etc
etc
Mar 30 '07 #3
thanks all for replying. I used your advise and it worked!
Jun 25 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Gilles Kuhn | last post: by
16 posts views Thread by Stoic | last post: by
15 posts views Thread by Mason A. Clark | last post: by
6 posts views Thread by Henry | last post: by
2 posts views Thread by =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.