Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何在表单中进行对齐?_Html - Fatal编程技术网

Html 如何在表单中进行对齐?

Html 如何在表单中进行对齐?,html,Html,这是一个简单的html代码,当我在firefox中打开它时,输入行之间没有对齐 <!DOCTYPE html> <html> <body> <form action=""> First name(xing): <input type="text" name="firstname"><br> Last name(min): <input type="text" name="lastname"> </form

这是一个简单的html代码,当我在firefox中打开它时,输入行之间没有对齐

<!DOCTYPE html>
<html>
<body>

<form action="">
First name(xing): <input type="text" name="firstname"><br>
Last name(min): <input type="text" name="lastname">
</form>

<p><b>Note:</b> The form itself is not visible. Also note that the default width of a text field is 20 characters.</p>

</body>
</html>

姓(星):
姓氏(最小): 注意:表单本身不可见。还要注意,文本字段的默认宽度为20个字符

如何在表单中进行对齐


尝试将文本置于span标记中表单输入之前,并设置其样式:

<span style="display:inline-block; width:125px">First name(xing): </span>
<input type="text" name="firstname">
    <br>
<span style="display:inline-block; width:125px"> Last name(min): </span>
<input type="text" name="lastname">
名字(姓):

姓氏(最小):
注意:如果使用样式“显示:内联块”,则只能使用“宽度”属性

另一种方法是:

<input type="text" name="fname" placeholder="First name(xing)"><br>
<input type="text" name="lname" placeholder="Last name(min)"><br>


这是HTML5占位符属性。

可能重复的