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:
input[type=password] {
background: yellow;
}
Practical example
In this example, we present how to use CSS attribute selector to style only those input elements, that are password type.
// ONLINE-RUNNER:browser;
<!doctype html>
<html>
<head>
<style>
input[type=password] {
background: #ffe973;
}
</style>
</head>
<body>
<input type="text" placeholder="username" />
<input type="password" placeholder="password" />
<input type="password" placeholder="confirm password" />
</body>
</html>