File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes style of a button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "style of a button" Watch "style of a button" New topic
Author

style of a button

JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
I want to know if it is possible to underline the text of a button?
How can I do it? Is it also possible to left align the text of a button?

<code>
<input type='button' value='Test'/>

</code>

The value = Test should be underlined and left aligned.


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Have you tried to use CSS?

Eric
JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
Yes, I am using CSS to style the button. However, I am unable to find code snippet, which would allow me to underline the text and also, left align the text of a button?

Any help or links, please assist!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Originally posted by JayaSiji Gopal:
Yes, I am using CSS to style the button!


That's important information that you should have included in your first post. Otherwise, it makes it sound like you don't know about CSS at all.

I have found that most browsers ignore many CSS rules, such as underline, for input buttons. Some browsers support more rules for the <button> control, but the support is still spotty. For example, Safari will undeline the text of a <button> but Firefox will not.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
Also, the application would be used by users in IE6 and IE7. Could anybody please help me find the code snippet to style the button text?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

I fired up Parallels so I could run XP and check it out in IE 7.

IE 7 appears to honor the normal CSS rules without issue for both <input type="button"> and <button>. You'll have to test IE 6 on your own.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1164
IE 6 seems to be fine as well -



Regards,
Dan
[ June 04, 2007: Message edited by: Bear Bibeault ]

William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
Dan,

Would you also know the code snippet to left align the text of a button?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60071
    
  65

Basic CSS: text-align: left

You should be sure to have a CSS reference handy.
 
 
subject: style of a button
 
Similar Threads
Print to formated text
XSLT how to: transform item list to the table
Having trouble with a javascript assignment
Unhide the text field
JSP Help Regarding the Radio Button