Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <head> <style> input:focus { background-color:yellow; } </style> </head> <body> <p>Click inside the text fields to see a yellow background:</p> <form> First name: <input type="text" name="firstname" /><br> Last name: <input type="text" name="lastname" /> </form> <p><b>Note:</b> For :focus to work in IE8, a DOCTYPE must be declared.</p> </body> </html>
Result:
W3Schools.com - Try it yourself