:focus





css/style.css
  • input:focus {
  •  background-color: #CCFFFF;
  • }
input:focus {
 background-color: #CCFFFF;
}


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  • </head>
  • <body>
  •  <input type="text" />
  •  <br />
  •  <br />
  •  <input type="text" />
  •  <br />
  •  <br />
  •  <input type="submit" value="OK" />
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <link href="css/style.css" rel="stylesheet" />
  • </head>
  • <body>
  •  <input type="text" />
  •  <br />
  •  <br />
  •  <input type="text" />
  •  <br />
  •  <br />
  •  <input type="submit" value="OK" />
  • </body>
  • </html>