Skip to content

Instantly share code, notes, and snippets.

@amorey
Last active August 29, 2015 14:22
Show Gist options
  • Save amorey/7106a6604dc2466ae215 to your computer and use it in GitHub Desktop.
Save amorey/7106a6604dc2466ae215 to your computer and use it in GitHub Desktop.
Input Animation Example
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- load MUI -->
<link href="//cdn.muicss.com/mui-0.1.4/css/mui.min.css" rel="stylesheet" type="text/css" />
<script src="//cdn.muicss.com/mui-0.1.4/js/mui.min.js"></script>
<!-- custom css -->
<style>
.bar {
position: relative;
display: block;
}
.bar:before,
.bar:after {
content: '';
height: 2px;
width: 0;
bottom: 1px;
position: absolute;
background: #2196F3;
transition: 0.2s ease all;
}
.bar:before {
left: 50%;
}
.bar:after {
right: 50%;
}
.mui-form-control:focus {
border-color: transparent;
}
.mui-form-control:focus ~ .bar:before,
.mui-form-control:focus ~ .bar:after {
width: 50%;
}
</style>
</head>
<body>
<form>
<div class="mui-form-group">
<input type="text" class="mui-form-control">
<label class="mui-form-floating-label">Name</label>
<span class="bar"></span>
</div>
</form>
</body>
</html>
@dandv
Copy link

dandv commented May 31, 2015

Very cool! Thanks for sharing the demo as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment