我有这样的标记:
<label>First Name: <input type="text" /></label>
<label>Last Name: <input type="text" /></label>
<label>Email: <input type="text" /></label>
Run Code Online (Sandbox Code Playgroud)
和这样的CSS:
label{display:block; padding:10px 0;}
input{position:absolute; left:100px;}
Run Code Online (Sandbox Code Playgroud)
在我测试的几乎所有浏览器中,结果都是这样的:
它的工作正常,而没有top
或bottom
在CSS代码中absolute
定位input
s.我的问题是:这种对齐元素是一种很好的做法,你知道浏览器有这种定位的任何问题吗?
这是代码的小提琴.