Reputation: 11
For fileUpload control, there is a embeded button "Browse" button for looking file on local machine.
Is it possible to change the style of this button? for example apply style sheet on it?
Upvotes: 1
Views: 8476
Reputation: 991
It works, with the help of CSS and programming techniques; the way i always used to follow is as follows:
<style>
.mainDiv {
position:relative; height:auto; width:300px;
}
#brwShow {
position: absolute;
text-align:right;
top: 0px;
left: -1px;
z-index: 1;
background:#F60;
height:26px;
width:240px;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
line-height:26px;
color:#FFF;
margin-left:10px;
}
#brwField {
width:155px;
height:26px;
margin-right:85px;
font-size:16px;
border:solid 1px #000;
}
#hideBrowse {
position:relative;
width:240px;
height:26px;
text-align: right;
-moz-opacity:0 ;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
}
.textUpload {
position:absolute;
height:20px;
width:100px;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
color:#FFF;
left: 183px;
top: 3px;
line-height:20px;
z-index:10001;
}
</style>
And the html is
<div class="mainDiv">
<input type="file" size="24" id="hideBrowse" onchange="getElementById('FileField').value = getElementById('BrowserHidden').value;" />
<div id="brwShow"><input type="text" id="brwField" /></div>
<div class="textUpload">Upload</div>
</div>
Upvotes: 1