EN
CSS - style input file field
0 points
In this article, we would like to show you how to style input file field using CSS.
In this example, we use attribute selector to set file input display
property and hide the element. To actually style the input
, we style the label
element which is the hidden input
wrapper.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
input[type="file"] {
7
display: none;
8
}
9
10
.custom-input {
11
border: 2px solid red;
12
background: yellow;
13
display: inline-block;
14
padding: 6px 12px;
15
cursor: pointer;
16
}
17
18
</style>
19
</head>
20
<body>
21
<label class="custom-input">
22
<input type="file"/>
23
Upload file
24
</label>
25
</body>
26
</html>