Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <form action="">
    <input type="text" name="name" id="name" required>
    <label for="name">Name</label>
    <br><br>
    <input type="submit" value="Ok">
  </form>
</body>
</html>
 
form {
  position: relative;
  padding-top: 30px;
  overflow: hidden;
}
label {
  display: inline-block;
  position: absolute;
  top: 0;
  left: 0;
}
input:required:focus ~ label {
  color: blue;
}
input:required ~ label {
  color: red;
}
input:required:hover ~ label {
  color: green;
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers