SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Posts rarely lloydi's Avatar
    Join Date
    Jan 2002
    Location
    Swindon UK
    Posts
    620
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can I apply CSS styles to Browse button?

    I need to work out how to affect the look of the browse button when you use

    <input type="file">

    Incidentally, I cannot seem to change the value from Browse ... to '...' oranything else for that matter.

    Never tried this before! Is it possible?
    Build Your Own Web Site the Right Way!
    A beginners' HTML/CSS book with web standards at its heart
    The Ultimate HTML Reference
    A complete reference, in glorious hardback

  2. #2
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've seen this again and again and I've never seen anyone post an answer -- searched myself and came up blank. I can only think this must mean you can't ....

  3. #3
    SitePoint Addict psychedelic's Avatar
    Join Date
    Feb 2002
    Location
    Boston
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the input property does it methinks. it'll look like the "search" buttons on search forms, etc. i do it as a global definition as opposed to applying it to each element.
    The Internet is prettier on a Mac.

  4. #4
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you apply the style to the <INPUT> tag, then the browse button will inherit it. You can't change the wording or use a graphic however without some javascript behind it.
    Wayne Luke
    ------------


  5. #5
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I'm pretty sure it is impossible to apply any styles at all to that particular button. This is a browser security feature - if you could style the button with CSS you could potentially make it look different enough from normal buttons to trick a user in to uploading a file that they did not want to upload. For the same reason, you can't access or change the value of the browse field using javascript.

  6. #6
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Actually, I can prove you can... Just reply to this message and look at the browse button underneath the text box. In IE 5.5+, it inherits the styles properly. It doesn't in Mozilla 1.0 thought and I can't really be bothered to check in Opera right now.
    Wayne Luke
    ------------


  7. #7
    Drupaler bronze trophy greg.harvey's Avatar
    Join Date
    Jul 2002
    Location
    London, UK
    Posts
    3,258
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dur. Oh yeh!

    <input type="file" class="bginput" name="attachment">

    I'm sure I tried that before and it didn't work???


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •