Continuing in our effort to save space, we will endeavor to expand text containers on focus.
Prepare our DOM for this recipe where each text field greets the focus from the user by expanding smoothly, create regular INPUT
elements. The code snippet in the book also includes a TEXTAREA
. Also define two states of CSS to represent both blurred and focused elements.
... <tr> <td align="right"><label for="name">Your Name</label></td> <td><input type="text" value="" name="name" id="name"></td> </tr> <tr> <td align="right"> <label for="email">Your Email Address</label> </td> <td> <input type="text" value="" name="email" id="email"> </td> </tr> ... <style type="text/css"> .blurred_element { width:100px; background-color:#FFFFFF; } .focused_element { width:300px; background-color:#FFF79F; } </style>