-4

I have a file input button design (it is the second button that says UPLOAD) how would I accomplish this design in HTML using CSS and or Javascript???

IMGUR image

2
  • I have reworded the question Commented May 20, 2014 at 18:54
  • You should offer what you have tried Commented May 21, 2014 at 17:16

1 Answer 1

2

ok try this out:

html:

<p class="form"> <input type="text" id="path" /> <label class="uploadFile">upload<span><input type="file" id="myfile" name="myfile" /></span> </label> </p> 

css:

.form input[type="file"]{ z-index: 999; line-height: 0; font-size: 50px; position: absolute; opacity: 0; filter: alpha(opacity = 0);-ms-filter: "alpha(opacity=0)"; cursor: pointer; _cursor: hand; margin: 0; padding:0; left:0; } .uploadFile{ position:relative; overflow:hidden; cursor:pointer; text-align:center; background-color:#fff; display:block; width:197px; height:31px; font-size:18px; line-height:30px; float:left; color:#000; border:solid 1px #000; } input[type="text"]{ border: none; position: absolute; top: 50px; width: 200px; } 

js:

$('#myfile').change(function(){ $('#path').val($(this).val()); }); $(function(){ if($("#path").val() == ""){ $("#path").val("No file choosen"); } }); 

fiddle

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.