Hidden file input element - HTML CSS CSS Form

HTML CSS examples for CSS Form:input

Description

Hidden file input element

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.upload-wrapper {<!--from  ww  w .ja  va 2 s  .c om-->
   width:251px;
   height:251px;
   margin:0 auto;
}

.upload-wrapper img {
   width:251px
   height: 281px;
   cursor:pointer;
}

[for="file-input"] {
   display:block;
   background-color:Chartreuse;
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   background-repeat:no-repeat;
   background-size:cover;
   width:251px;
   height:251px;
}

.upload-wrapper input {
   display:none;
}
</style> 
 </head> 
 <body> 
  <!-- start upload wrapper --> 
  <div class="upload-wrapper"> 
   <form enctype="multipart/form-data" action="photo_setup.php" method="POST"> 
    <label for="file-input"> </label> 
    <input type="file" name="photo" id="file-input" accept="image/*"> 
   </form> 
  </div> 
  <!-- end upload wrapper -->  
 </body>
</html>

Related Tutorials