Reputation: 11363
I have a fiddle describing this issue. Given the html
<input type="file" name="geoFile" class="file-drop" >
which in turn generates the following shadow dom structure:
<input type="file" name="geoFile" class="file-drop">
#shadow-root (user-agent)
<input type="button" value="Choose File" pseudo="-webkit-file-upload-button">
#shadow-root (user-agent)
Choose File
</input>
</input>
How can I set display:none
to the button inside the first shadow-root
?
I've tried
.file-drop {
width: 150px;
height: 150px;
border: 5px dashed darkgrey;
input[type='button'] {
display: none;
}
}
but the button style is still showing.
Upvotes: 1
Views: 786
Reputation: 241258
To select the button, you could use the selector .file-drop::-webkit-file-upload-button
.
Since you're using SASS, it would be:
.file-drop {
width: 150px;
height: 150px;
border: 5px dashed darkgrey;
&::-webkit-file-upload-button {
display: none;
}
}
As your question implies, this only applies to -webkit
browsers since each browser has their own implementation.
Upvotes: 2