Show input type file as button

Created 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">
    <style>
    .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);
    }
    </style>
    

    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

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.