对齐标签的右侧文本(内联块)

时间:2012-12-05 15:24:39

标签: forms size alignment css

在此示例中:http://jsfiddle.net/6L6ZL 是否可以正确对齐标签的文本而不指定WIDTH 尺寸?

<html>
<head>
<style>
fieldset {
display: inline-block;
}

fieldset input{
float: right;
}
</style>
</head>
<body>

<form>
<fieldset>
    <p><label>First Name</label><input type="text" /></p>
    <p><label>Second Name</label><input type="text" /></p>
    <p><label>Address</label><input type="text" /></p>
    <p><label>Age</label><input type="text" /></p>
</fieldset>
</form>

</body>
</html>

Image

1 个答案:

答案 0 :(得分:2)

text-align:right;添加到<p>元素。

相关问题