Inspired by "Float Label Pattern Standard" from Matt D. Smith
UPDATE To improve the animation a bit, I switched to CSS keyframes now. In the first version, the labels would fly over the text input. The placeholder now first fades out and then appears again above the input field and finally docks to the final position. This might seem a minor change but this approach seems to be a lot more versatile while still very clean.
After experimenting with pure CSS float labels and realizing that this is currently not feasible in a semantically clean way; I decided to built another version which degrades gracefully to older browser versions and non-js users.
The main point is: We don't want to have labels placed next to the input fields but we have to deal with clients that either do not support input::placeholder attributes or cannot change layout dynamically because Javascript is off/broken/old/whatever.
Solution: The floated label is the new standard layout! On Javascript enabled clients, the label will be moved to the normal placeholder position on load. After user input, it is pushed to the top left corner and stays there, exactly as @mds has designed it to be. On Non-Javascript clients, the label will just remain in the top left corner from the beginning, eventually changing color on focus/blur.
This brings you placeholder support for older browsers unobtrusively and for free.
See the Pen GD Float Labels Minimal by Peter Sorowka ( @psorowka ) on CodePen
tweet me @psorowka