EN
CSS - style input placeholder text
0 points
In this article, we would like to show you how to style input's placeholder text using CSS.
Quick solution:
xxxxxxxxxx
1
input::placeholder {
2
font-style: italic;
3
opacity: 0.5;
4
color: red;
5
}
In this example, we present how to use ::placeholder
pseudo-element to style input's placeholder text.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
input::placeholder {
7
font-style: italic;
8
opacity: 0.5;
9
color: red;
10
}
11
12
</style>
13
</head>
14
<body>
15
<input type="text" placeholder="Placeholder text...">
16
</body>
17
</html>