File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Write Some Text in a Horizontal Rule?

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can't write text in it...

best you can do would be

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMAGE or the way I did it??
 
Weerawit Maneepongsawat
Ranch Hand
Posts: 203
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we use this?

 
Julian Kennedy
Ranch Hand
Posts: 823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1309
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But, according to Eric's method, the line is not through the text. The line breaks around the text.
 
Julian Kennedy
Ranch Hand
Posts: 823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic