gpt4 book ai didi

jquery - 如何将文件输入按钮放置在文本字段内的右侧

转载 作者:太空宇宙 更新时间:2023-11-03 23:55:16 24 4
gpt4 key购买 nike

如何将文件输入按钮放置在文本字段内的右侧这是我的 fiddle http://jsfiddle.net/cancerian73/TurGw/

这就是我想要的截图 enter image description here

input[type=file] {
-webkit-appearance: textfield;
position: relative;
-webkit-box-sizing: border-box;
}
input[type=file]::-webkit-file-upload-button {
width: 0;
padding: 0;
margin: 0;
-webkit-appearance: none;
border: none;
}
/* "x::-webkit-file-upload-button" forces the rules to only apply to browsers that support this pseudo-element */
x::-webkit-file-upload-button, input[type=file]:after {
content:'Browse...';
display: inline-block;
left: 100%;
margin-left:3px;
position: relative;
-webkit-appearance: button;
padding: 3px 8px 2px;
}

最佳答案

你只是“伪造”了一个边框

fiddle :http://jsfiddle.net/TurGw/3/

HTML:

<form action="" method="post">
<div class='upload-border'>
<input type="file" name="upload"/>
</div>
</form>

CSS:

.upload-border{
border:1px solid black;
width:315px;
}
input[type=file]::-webkit-file-upload-button {
width: 0;
padding: 0;
margin: 0;
-webkit-appearance: none;
border: none;
border:0px;
}

x::-webkit-file-upload-button, input[type=file]:after {
content:'Browse...';
left: 100%;
margin-left:3px;
position: relative;
-webkit-appearance: button;
padding: 3px 8px 2px;
border:0px;
}

关于jquery - 如何将文件输入按钮放置在文本字段内的右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18917710/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com