0

I am using:

<div class="upload-area"> 
   <input type="file" name="attachemnt" class="buttonclass" /> 
</div> 

I am trying to hide the default css button, and make nice one, but I cannot figure out how.

Can someone help?

Jonathan Eustace
  • 2,469
  • 12
  • 31
  • 54
xul
  • 210
  • 5
  • 15

1 Answers1

2

There is no standard way to this. You can do only with hacks. This method will good for you

.fileInput {
    cursor: pointer;
    height: 25px;
    overflow: hidden;
    position: relative;
    width: 100px;
}

.fileInput em {
    background: linear-gradient(to bottom, #D65A75 0%, #CD4874 100%) repeat scroll 0 0 transparent;
    color: #FFFFFF;
    cursor: pointer;
    display: inline-block;
    font-family: 'Arial';
    font-size: 15px;
    font-style: normal;
    margin-top: 5px;
    padding: 4px 7px;
    text-decoration: none;
    text-shadow: 1px 1px 0 #B8283D;
}

.fileInput input {
    bottom: 0;
    cursor: pointer;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
}

The HTML markup:

<span class="fileInput">
    <input id="file" type="file" name="file">
    <em>Browse computer</em>
</span>

Working demo at http://jsfiddle.net/GHbNa/

Arpad Bajzath
  • 896
  • 8
  • 19