I have an HTML input element. I want the element to be in the center, but because the right margin is not working, the element is slightly off to the right. box-sizing: border-box;
does not resolve the issue.
My code
body {
margin: 0;
padding: 10px;
font-family: Arial, Helvetica, sans-serif;
}
* {
margin: 40px;
padding: 10px;
}
input {
border-style: solid;
border-color: #5f9341;
border-width: 2px;
width: 100%;
box-sizing: border-box;
}
<html>
<head>
<link rel="stylesheet" href="css/index.css">
<script src="js/index.js"></script>
</head>
<body>
<input type="text" id="input-el">
<button id="input-btn">SAVE INPUT</button>
</body>
</html>