如何右对齐表单输入框? [英] How to right-align form input boxes?
本文介绍了如何右对齐表单输入框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个看似容易解决的问题,但我在努力。我如何获得这两个输入对齐到窗体的权利,不需使用BR元素?
I have a seemingly easy problem to solve, but am struggling. How do I get these two inputs to align to the right of the form, without using the BR element ?
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
form {
text-align: right;
}
input {
width: 100px;
}
</style>
</head>
<body>
<form>
<input name="declared_first" value="above" />
<br/> <!-- I want to get rid of this -->
<input name="declared_second" value="below" />
</form>
</body>
</html>
我只是想第一个输入出现上面的第二个输入,无论是在右侧。
I just want the first input to appear above the second input, both on the right hand side.
推荐答案
请参阅 http://jsfiddle.net/gUytH/
使用浮动的权利和清除它们。
Use floating to the right and clear them.
input {
float:right;
clear:both;
}
这篇关于如何右对齐表单输入框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文