html 如何为输入文件类型在文本框和浏览按钮之间添加空格

tez616oj  于 5个月前  发布在  其他
关注(0)|答案(4)|浏览(47)

我们可以在浏览按钮和输入类型文件的文本框之间添加空间吗?可以吗?我也可以为同一个文本框添加边框颜色吗?
谢谢,
米凯尔德

uxh89sit

uxh89sit1#

你应该使用css来做到这一点:你的html:

<input type="text" class="yourclass" name="yourname" />
    <input type="submit" />

字符串
你的css:

<style> input.yourclass { border:1px solid red; margin-right: 10px;} </style>


希望这能让你走上正确的方向

noj0wjuj

noj0wjuj2#

它在Chrome中为我工作。

input.file {
    text-indent: initial;
}

字符串

dffbzjpn

dffbzjpn3#

增加间距是不可能的。一般来说,样式化input type="file"是非常困难的。如果你检查跨浏览器,你可以看到不同的浏览器呈现它的方式不同。样式化它的唯一方法是将另一个元素伪造为input type="file"
示例:http://www.quirksmode.org/dom/inputfile.html

plicqrtu

plicqrtu4#

在输入按钮的右边加边距

// using css
<style>
input[type="file"]::file-selector-button {
    margin-right: 4px;
}
</style>

// using tailwind
<input type="file" class="file:mr-4" />

字符串

相关问题