我有这段代码在chrome中可以正常工作,但是在chrome之外的其他浏览器中,我将该区域隐藏了。之前和之后不适用于其他浏览器的自动关闭标签,但是我将如何适应所有浏览器的相同设计。
.inputDnD .form-control-file {
position: relative;
width: 100%;
height: 100%;
min-height: 10em;
outline: none;
visibility: hidden;
cursor: pointer;
background-color: #c61c23;
}
.inputDnD .form-control-file::before {
content: attr(data-title);
position: absolute;
top: 0.5em;
left: 0;
width: 100%;
min-height: 8em;
line-height: 2em;
padding-top: 1.5em;
opacity: 1;
visibility: visible;
text-align: center;
border: 2px dotted #cbcbcb;
border-radius: 8px;
white-space: pre;
background: #fafafa;
overflow: hidden;
font-weight: 100;
padding: 25px;
font-size: 12px;
}
.inputDnD .form-control-file:hover:before {
border-style: dotted;
border-radius: 8px;
}
<div class="form-group inputDnD">
<label class="sr-only" for="inputFile">File Upload</label>
<input type="file" multiple class="form-control-file font-weight-bold float-right" id="inputFile" name="inputFile" onchange="readUrl(this)" data-title="Drag & drop file 
 OR 
 Browse" />
</div>