HTML CSS examples for CSS Form:Form
Forms: centering vertically
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .m-form {<!--from w w w.ja v a 2 s.c o m--> margin-top:3em; font-family:Arial, Helvetica, sans-serif; } .m-form:first-child { margin-top:0; } .m-form ol { list-style:none; margin:0; padding:0; } .m-form ol>li { margin:2.6em 0 0; } .m-form ol>li:after { content:""; display:table; clear:both; } .m-form label:first-child { box-sizing:border-box; display:block; float:left; padding:.26em 3em .26em 0; vertical-align:top; width:51%; font-weight:bold; line-height:2.6; text-align:right; } .m-form .m-form__textfield { box-sizing:border-box; float:left; padding:.6em; width:51%; border:2px solid Chartreuse; border-radius:4px; } .m-form .is-large label:first-child { font-size:2.9em; } li { position:relative; } li input { height:31px; position:absolute; top:51%; margin-top:-16px; } </style> </head> <body> <form action="" class="m-form"> <ol> <li> <label for="sample">Lorem ipsum do</label> <input type="text" id="sample" class="m-form__textfield" value="A Sample Input"> </li> <li class="is-large"> <label for="sample">Lorem ipsum do</label> <input type="text" id="sample" class="m-form__textfield" value="A Sample Input"> </li> </ol> </form> </body> </html>