I work with a style input file using the opacity method - the real input button has an opacity of 0 and in front of it using z-index is another input (with opacity: 1). Unfortunately, I want my visible button to be a square picture (width: height: 1: 1) - and the invisible input file is always rectangular (input field and selection field with an aspect ratio of about 1:10). The question is how to resize the button of the input file to a square (or any size) to make the visible area of the visible button pressed (because only clicking an invisible button causes the browser window to open). Now only part of the visible button is clickable.
CSS
<style type="text/css"> .upload { position:relative; width:100px; } .realupload { position:absolute; top:0; right:0; opacity:0.5; -moz-opacity:0.5; filter:alpha(opacity:0.5); z-index:2; width:100px; } form .fakeupload { background: url(images/bglines.png); } form .fakeupload input { width:0px; } </style>
And html:
<form> <li class="upload"> <div class="fakeupload"> <input type="text" name="fakeupload" style="opacity: 0;"/> </div> <input type="file" name="upload" id="realupload" class="realupload" onchange="this.form.fakeupload.value = this.value;" style="font-size: 5px;" /> </li> </form>
Kalreg
source share