I'm trying to put a spin on this article to provide a nicer-looking user interface for a file upload input. In short, it's primarily a CSS-only method for hiding the browser's native input button and replacing it with a style label. The project I want to use it in also happens to be an Ionic3 project, and so I'd like the label that to be styled to look like a natural ion-button.
The code from the article works great if the label contains a plain text, but if I try and embed a button-element within the label, I get no love, regardless of whether I use the ion-button attribute incidentally.
.inputfile {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
position: absolute;
z-index: -1;
}
.inputfile + label {
display: inline-block;
}
.inputfile + label {
cursor: pointer; /* "hand" cursor */
}
<input type="file" name="file" id="file" class="inputfile" />
<label for="file">Choose a file text label</label> <-- this works
<br/><br/>
<input type="file" name="file" id="file" class="inputfile" />
<label for="file">
<button>Choose a file button label</button>
</label> <-- this doesn't work