Ordinary input of type file in webpages comes with a default style and the caption, choose file. The good news is that we can style and tweak it to what we want.
<input type="file" accept="image/png, image/jpg, image/gif, image/jpeg"/>
There are three steps to this:
label
element<label for="inputTag"> Select Image <input id="inputTag" type="file"/> </label>
input
tag to none
input{ display: none; }
label
elementHere, you can add more elements or icons. This is where the magic comes in.
label{ cursor: pointer; }
We have looked at how to style the input file type that normally appears in a default “choose file” format. One of these ways is to set the display
to none
. This way, we can style the label and add some icons.
RELATED TAGS
CONTRIBUTOR
View all Courses