GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes How To Write Some Text in a Horizontal Rule? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How To Write Some Text in a Horizontal Rule?" Watch "How To Write Some Text in a Horizontal Rule?" New topic
Author

How To Write Some Text in a Horizontal Rule?

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I would like to have something similar to a horizontal rule (with certain height, of course) and show some text in it?

Do I really use <HR size=30, aligh="center">? How do I write some text in it?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you can't write text in it...

best you can do would be

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I have seen in web pages that there is a horizontal bar with a color; say, green. And there is some text in the bar with another colore; say, yellow. How is it been done?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
IMAGE or the way I did it??
Weerawit Maneepongsawat
Ranch Hand

Joined: Apr 11, 2002
Posts: 203
Can we use this?



Weerawit<br />SCJP 1.4, SCWCD 1.2, SCWCD 1.4, SCBCD 1.3, SCBCD 5.0, SCMAD 1.0, SCJA 1.0, SCDJWS, SCJD, SCEA, SCDJWS 1.5
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
I guess you could use <s> or <strike> if you want the line through the text rather than wanting the line to break around the text. You could even use a combination of strike and NBSP but it's messy. Note that <strike> is deprecated in HTML 4 in favour of the CSS text-decoration: line-through style.

Eric's method is cleanest as it uses HTML 4 and CSS and no table for layout.

Jules
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
But, according to Eric's method, the line is not through the text. The line breaks around the text.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
If you want the line through the text then use <strike> with HTML 3.2 or style="text-decoration: line-through;" with HTML 4 or XHTML.

Jules
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To Write Some Text in a Horizontal Rule?