如何让html中input⾃动对齐,html–如何正确对齐span和input元
素?
我通过使⽤外部样式表(例如
html span 居中normalize.css)到了成功.它们对于确保您的标记在所有浏览器中保持⼀致⾮常有⽤.
另⼀种解决⽅案是执⾏以下操作:
t {
margin: 5px;
}
.one {
background-color: #ffffff;
border: solid 1px #ADADAD;
height: 17px;
}
.two {
background-color: #ffffff;
border: solid 1px #ADADAD;
height: 17px;
}
.in {
background-color: #ffffff;
border: solid 1px #ADADAD;
height: 17px;
}
input {
position: relative;
top: -1px;
padding: 0;
}
Test in Span
Span in test
简单地偏移< input>通过增加
input {
position: relative;
top: -1px; }