Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cursor:pointer not working on input type file [duplicate]

Possible Duplicate:
Change cursor type on input type=“file”

This is my jsfiddle:

http://jsfiddle.net/3zNMK/

This class already has a cursor but not working:

.file
{
    cursor:pointer;
}

I want that even though a hover is made on textbox inside input type file, it should change to hand icon. But it is not working.

Any way to change this behavior?

like image 303
Jack Avatar asked Nov 06 '12 10:11

Jack


1 Answers

Try some manipulation like this

HTML

<span class="file-wrapper">
  <input type="file" name="photo" id="photo" />
  <span class="button">Choose a File</span>
</span>

CSS

.file-wrapper {
  cursor: pointer;
  display: inline-block;
  overflow: hidden;
  position: relative;
}
.file-wrapper input {
  cursor: pointer;
  font-size: 100px;
  filter: alpha(opacity=1);
  -moz-opacity: 0.01;
  opacity: 0.01;
  position: absolute;
  right: 0;
  top: 0;
}
.file-wrapper .button {
  background: #333;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  color: #fff;
  cursor: pointer;
  display: inline-block;
  font-size: 11px;
  font-weight: bold;
  margin-right: 5px;
  padding: 4px 18px;
  text-transform: uppercase;
}
​

DEMO

like image 169
Sowmya Avatar answered Sep 30 '22 14:09

Sowmya