Howdy! I'm Jiby and I'm a web designer creates attractive, accessible standard compliant websites good at css, html

 
 

Styling File Inputs using CSS and jquery

Nov 02 2009

Normally browsers do not allow to style file inputs. File Style plug-in shows a solution to fix the problem. This Plug-in uses jquery with css which enables the users to use image as browse button and style filename field as normal text field using CSS.

This Source of this post is from appelsiini

How does it work?

Plug-in wraps vanilla file input with div. This div has button as background image. Image button is aligned with file inputs browse button. File input is then hidden by setting opacity to zero. Chosen file is shown in normal text input which mimics file input. This text input also inherits file inputs class. Use this class to style the text input.

How to use?

Insert the jquery and filestyle js files to the header section of html

<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.filestyle.js" type="text/javascript"></script>

The button image used in the code is here.
choose-file
The java script code for styling the file input is as follows.

$("input[type=file]").filestyle({
     image: "choose-file.gif",
     imageheight : 22,
     imagewidth : 82,
     width : 250
 });

You can view the demo of the plug-in from here
Download the javascript file from here.

Bookmark this..

http://www.jibysk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/magnolia_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/google_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/twitter_48.png http://www.jibysk.com/wp-content/plugins/sociofluid/images/meneame_48.png

Tags: | |

One Response to “Styling File Inputs using CSS and jquery”


1

Wow!!!!!!!!
Fantastic tools!!!
Thank you!!!!

Leave a Reply