I have a div with two + and - buttons and an hidden input. When I click on the buttons the value in the input should increase or decrease and the input should become visible. The problem is that, depending on the zoom and maybe on firefox vs chrome, the buttons and inputs break up in three rows. How to keep buttons and input horizontally aligned?
<!DOCTYPE html>
<html>
<head>
<script>
function showInput(){
input=document.getElementById("input")
div=document.getElementById("mydiv")
input.style.width="40px";
div.style.width="90px";
input.style.visibility = "visible";
};
function change(increment){
input=document.getElementById("input")
input.value=Number(input.value)+increment;
input.style.visibility='visible';
console.log(input.value)
}
</script>
</head>
<body>
<a href="https://stackoverflow.com/questions/3977596/how-to-make-divs-in-html5-draggable-for-firefox">I will check this to make it draggable in firefox</a>
<div id="mydiv" style="position: absolute; left: 450px; top: 2px; background-color: lightgrey; padding: 1px;" draggable
="true">
<span>
<button id="btnm" onclick="showInput();change(-1);">-</button>
<button id="btnp" onclick="showInput();change(+1);">+</button>
<input id="input" value=1 style="visibility: hidden; width: 4px;">
</span>
</div>
</body>
</html>