如何在HTML/css中完全删除文本框的边距

Ror*_*ker 2 html css textbox margins

我有以下HTML

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <style>
    .box
    {
        border:solid black 1px;
        padding:0px;
        margin:0px;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <input class="box" style="width:300px;" /><br />
        <input class="box" style="width:150px;" />
        <input class="box" style="width:150px;" /><br />
        <input class="box" style="width:100px;" />
        <input class="box" style="width:100px;" />
        <input class="box" style="width:100px;" />
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这个想法是文本框应该在右侧完成像素完美.

我最终会在第2行和第3行添加间距以扩大宽度以进行补偿,但目前我想要渲染这个简单的样本.

那么如何删除这些文本框的边距以使对齐正确呢?

Gre*_*reg 6

由于他们之间的空白,他们没有排队.

如果要删除<input>元素之间的所有换行符和制表符,它将根据需要显示.