Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Simple Google Material text inputs
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Markshall" data-source="post: 440069" data-attributes="member: 1872"><p>It’s an old effect but one that I’ve only recently wanted to start implementing into projects, so here’s my attempt at achieving Google Material text inputs. You know the one.. where the line at the bottom of the field expands outwards</p><p></p><p>Use as you wish</p><p></p><p>You can view the pen here:</p><p></p><p><a href="https://codepen.io/Markshall/pen/JmxdMW" target="_blank">https://codepen.io/Markshall/pen/JmxdMW</a></p><p></p><p>Or find the code here:</p><p>[PHP]<!DOCTYPE html></p><p><html lang="en"></p><p><head></p><p> <meta charset="UTF-8"></p><p> <title>Document</title></p><p> </p><p> <style></p><p> * {</p><p> box-sizing: border-box;</p><p> }</p><p> </p><p> body {</p><p> font: 400 14px/1.6 'Helvetica Neue', Arial, sans-serif;</p><p> }</p><p> </p><p> .wrapper {</p><p> position: absolute;</p><p> top: 50%;</p><p> left: 50%;</p><p> transform: translate(-50%, -50%);</p><p> padding: 15px 20px;</p><p> width: 350px;</p><p> background-color: #e9e9e9;</p><p> }</p><p> </p><p> .input-group {</p><p> margin-bottom: 15px;</p><p> }</p><p> </p><p> .input-wrapper {</p><p> position: relative;</p><p> }</p><p> </p><p> input[type="text"], input[type="password"], input[type="email"], input[type="submit"] {</p><p> border: 0;</p><p> margin: 0;</p><p> font: inherit;</p><p> font-size: 13px;</p><p> outline: none;</p><p> padding: 6px 9px;</p><p> border-radius: 3px;</p><p> width: 100%;</p><p> background-color: #fff;</p><p> }</p><p> </p><p> input[type="submit"] {</p><p> background-color: cornflowerblue;</p><p> border: 1px solid;</p><p> border-color: #4572c3 #4572c3 #375fa7 #4572c3;</p><p> border-bottom-width: 3px;</p><p> cursor: pointer;</p><p> color: #fff;</p><p> transition: all .2s ease-in-out;</p><p> }</p><p> </p><p> input[type="submit"]:hover {</p><p> transform: scale(1.02);</p><p> }</p><p> </p><p> input[type="submit"]:active {</p><p> transform: scale(0.98);</p><p> border-bottom-width: 1px;</p><p> box-shadow: 0 5px 20px rgba(0, 0, 0, .3);</p><p> }</p><p> </p><p> .input-line {</p><p> height: 1px;</p><p> position: absolute;</p><p> background-color: cornflowerblue;</p><p> transition: all .4s ease;</p><p> width: 0px;</p><p> left: 50%;</p><p> transform: translateY(-50%);</p><p> }</p><p> </p><p> .input-wrapper input:focus {</p><p> border-bottom-left-radius: 0px;</p><p> border-bottom-right-radius: 0px;</p><p> }</p><p> </p><p> .input-wrapper input:focus ~ .input-line {</p><p> width: 100%;</p><p> left: 0;</p><p> right: 0;</p><p> }</p><p> </style></p><p></head></p><p><body></p><p> </p><p> </p><p> <div class="wrapper"></p><p> </p><p> <div class="input-group"></p><p> <label for="username">Username</label></p><p> <div class="input-wrapper"></p><p> <input type="text" name="username" id="username" autocomplete="off" /></p><p> <div class="input-line"></div></p><p> </div></p><p> </div></p><p> </p><p> <div class="input-group"></p><p> <label for="password">Password</label></p><p> <div class="input-wrapper"></p><p> <input type="password" name="password" id="password" autocomplete="off" /></p><p> <div class="input-line"></div></p><p> </div></p><p> </div></p><p> </p><p> <div class="input-group"></p><p> <label for="email">Email</label></p><p> <div class="input-wrapper"></p><p> <input type="email" name="email" id="email" autocomplete="off" /></p><p> <div class="input-line"></div></p><p> </div></p><p> </div></p><p> </p><p> <input type="submit" value="Sign up"></p><p> </p><p> </div></p><p> </p><p></body></p><p></html>[/PHP]</p></blockquote><p></p>
[QUOTE="Markshall, post: 440069, member: 1872"] It’s an old effect but one that I’ve only recently wanted to start implementing into projects, so here’s my attempt at achieving Google Material text inputs. You know the one.. where the line at the bottom of the field expands outwards Use as you wish You can view the pen here: [URL]https://codepen.io/Markshall/pen/JmxdMW[/URL] Or find the code here: [PHP]<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> * { box-sizing: border-box; } body { font: 400 14px/1.6 'Helvetica Neue', Arial, sans-serif; } .wrapper { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 15px 20px; width: 350px; background-color: #e9e9e9; } .input-group { margin-bottom: 15px; } .input-wrapper { position: relative; } input[type="text"], input[type="password"], input[type="email"], input[type="submit"] { border: 0; margin: 0; font: inherit; font-size: 13px; outline: none; padding: 6px 9px; border-radius: 3px; width: 100%; background-color: #fff; } input[type="submit"] { background-color: cornflowerblue; border: 1px solid; border-color: #4572c3 #4572c3 #375fa7 #4572c3; border-bottom-width: 3px; cursor: pointer; color: #fff; transition: all .2s ease-in-out; } input[type="submit"]:hover { transform: scale(1.02); } input[type="submit"]:active { transform: scale(0.98); border-bottom-width: 1px; box-shadow: 0 5px 20px rgba(0, 0, 0, .3); } .input-line { height: 1px; position: absolute; background-color: cornflowerblue; transition: all .4s ease; width: 0px; left: 50%; transform: translateY(-50%); } .input-wrapper input:focus { border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; } .input-wrapper input:focus ~ .input-line { width: 100%; left: 0; right: 0; } </style> </head> <body> <div class="wrapper"> <div class="input-group"> <label for="username">Username</label> <div class="input-wrapper"> <input type="text" name="username" id="username" autocomplete="off" /> <div class="input-line"></div> </div> </div> <div class="input-group"> <label for="password">Password</label> <div class="input-wrapper"> <input type="password" name="password" id="password" autocomplete="off" /> <div class="input-line"></div> </div> </div> <div class="input-group"> <label for="email">Email</label> <div class="input-wrapper"> <input type="email" name="email" id="email" autocomplete="off" /> <div class="input-line"></div> </div> </div> <input type="submit" value="Sign up"> </div> </body> </html>[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Simple Google Material text inputs
Top