I want to put submit.png next to the input element.
This is the code i use:
<div class="input-box" style="height: 40px; width: 500px;">
<img src="img/delete.png" width="25px" height="25px;" style="position: absolute; right: 0;">
<input id="answer" type="text" style="border: none; border-bottom: 2px solid silver; height: 100%; width: 100%; font-size: 17px; background-color: #ffffff00; outline: none; color: white; font-weight: bold; text-align: center;" required readonly oninput="let p=this.selectionStart;this.value=this.value.toUpperCase();this.setSelectionRange(p, p);">
<img src="img/submit.png" width="25px" height="25px">
</div>
I have read other article that said i need to use display: inline-block and float: right attribute.
I have try that and still didn’t work.
Please help me
2
Answers
I’m not 100% sure if I understood the question but here is a solution with
display: flex
.Let me know if that helps.
Check this nice tutorial about "Flex".
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
you can use css below to put all elements in a div next to each other horizontally:
you can also use style below to align them vertically to the center: