Saving space on our site: expand text containers on focus

Continuing in our effort to save space, we will endeavor to expand text containers on focus.

Getting ready

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 ...

Get MooTools 1.3 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.