How can I make the img tag same align with the file upload input? I tried position:absolute but it doesn’t fit in responsive. Is there any text-align/align-items/justify-content can make it aligned?
.input-file{
padding:6px 10px;border:1px solid #d9d9d9; border-radius:8px;
}
<div>
<input class="input-file" type="file"/>
<img style="width:100px;height:100px;"/>
</div>
2
Answers
I recommend learning flexbox, it’s extremely useful.
The optimal approach here would be to put the
input
tag in a separatediv
and theimg
tag in anotherseparate
div with same class name.CSS: (Here,
diplay: inline-block
is used to align things vertically, which can be adjusted byvertical-align: middle/top/bottom
.)