我想包装一个隐藏的文件上传按钮,以便我可以本地化文本。这样可行。但是,我现在想用一个按钮而不是一个原始的填充 div 来包装标签和上传按钮。Every (3) css button library I have tried shows the button, poorly, File Open Dialog appears when file selected and Open click blank screen or an immediate post. 这是不可能的还是推荐一种将按钮包裹在本地化文件输入周围的替代方案?
> <style>
> .ui-widget-header, .ui-state-default, ui-button {
> background: #b9cd6d;
> border: 1px solid #b9cd6d;
> color: #FFFFFF;
> font-weight: bold;
> }
>
> input[type="file"] {
> display: none;
> }
>
> .custom-file-upload {
> border: 1px solid #ccc;
> display: inline-block;
> padding: 6px 12px;
> cursor: pointer;
> }
</style>
<div class="form-group"> <button class="btn-sm"> <label for="ediFile" class="custom-file-upload btn btn-default"> <span th:text="#{addYourEDI}"></span> <input type="file" name="ediFile" multiple="multiple" accept=".pdf,.xls,.xlsx,.csv,.zip" style="visibility: hidden;
位置:绝对;" class="btn btn-outline-secondary" id="ediFile" onchange="ediFileChange()"/>