EN
CSS - style input type password only
0 points
In this article, we would like to show you how to style HTML input element with type="password"
only using CSS.
Quick solution:
xxxxxxxxxx
1
input[type=password] {
2
background: yellow;
3
}
In this example, we present how to use CSS attribute selector to style only those input elements, that are password
type.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
input[type=password] {
7
background: #ffe973;
8
}
9
10
</style>
11
</head>
12
<body>
13
<input type="text" placeholder="username" />
14
<input type="password" placeholder="password" />
15
<input type="password" placeholder="confirm password" />
16
</body>
17
</html>