Show input type file as button

Updated at 12-Jul-2021, By samar

Show input type file as button

We will use programming in this lesson to attempt to solve the "Show input type file as button".

Default input type file element is not attractive. You can show the input type file as an attractive button using CSS.
  • Change default input type file button to custom design using CSS

    <input type="file" class="custom-input-file">
    .custom-input-file::-webkit-file-upload-button {
        visibility: hidden;
    .custom-input-file::before {
        content: 'Select some files';
        display: inline-block;
        background: linear-gradient(top, #f9f9f9, #e3e3e3);
        border: 1px solid #999;
        border-radius: 3px;
        padding: 5px 8px;
        outline: none;
        white-space: nowrap;
        -webkit-user-select: none;
        cursor: pointer;
        text-shadow: 1px 1px #fff;
        font-weight: 700;
        font-size: 10pt;
    .custom-input-file:hover::before {
        border-color: black;
    .custom-input-file:active::before {
        background: -webkit-linear-gradient(top, #e3e3e3, #f9f9f9);

    You can change the view of the default input type file element to an attractive button design using CSS. You can change the text, color and much more things as per your desire.

Back to code snippet queries related css