How to Change Placeholder Color with HTML & CSS

12/31/2020

Contents

Demo

Full Screen

Code

HTML

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>How to Change Placeholder Color</title>
    <link rel="stylesheet" type="text/css" href="https://demo.plantpot.works/assets/css/normalize.css">
    <link rel="stylesheet" href="https://use.typekit.net/opg3wle.css">
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
    <div id="container">
      <form class="form">
        <input class="form__input" type="text" name="text" placeholder="Placeholder">
      </form>
    </div>
  </body>
</html>

CSS

@charset "utf-8";
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
}
body {
  background-color: #925cff;
  font-family: futura-pt, sans-serif;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
#container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
  padding: 20px;
}
.form {
  width: 100%;
  max-width: 400px;
}
.form__input {
  width: 100%;
  height: 50px;
  padding: 0 10px;
  border: none;
  border-radius: 4px;
  color: #3d3935;
  font-size: 1.25rem;
  outline: none;
}
.form__input::placeholder {
  color: #925cff;
  font-size: 1.25rem;
}