I have an input group in a bootstrap form:
<div class="input-group">
<label class="input-group-btn">
<span class="btn btn-primary">Browse<input type="file" name="id_document" style="display:none" class="form-control" required id="id_id_document"></span>
</label>
<input type="text" class="form-control" id="id_document_filename" placeholder="No File Selected" readonly>
</div>
I would like to put an overlay over the button, that matches the button in size and position:
SCSS:
.btn {
background-image: url(/static/img/btn_bg.png);
&::before {
content: "";
position: relative;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(255,255,255,0.9);
}
}
The problem is, if position:relative, the element matches the button perfectly (according to safari devtools), but doesn't display. If I change it to position:absolute, it displays, but now is the size of the entire element.
Fiddle, though here for some reason the button is smaller in height than the input box, which makes the issue when position:absolute hard to see. On my site, this is not the case: https://jsfiddle.net/aq9Laaew/205866/