How do you style an input type=\"file\"
button?
Only this approach gives you the whole flexibility! ES6 / VanillaJS!
html:
javascript:
document.querySelector('button').addEventListener('click', () => {
document.querySelector('input[type="file"]').click();
});
This hides the input-file button, but under the hood clicks it from another normal button, that you can obviously style like any other button. This is the only solution with no downside apart from a useless DOM-node. Thanks to display:none;
, the input-button does not reserve any visible space in the DOM.
(I don't know anymore to whom to give props for this. But I got that idea from somewhere here on Stackoverflow.)