I want to centre align an input text box on a webpage and (for certain reasons) I want to use inline CSS only. I tried the following and several other techniques but none worked.
<input type="text" id="myInput" style= "margin: auto; width: 80%;background-repeat: no-repeat;" >
I suspect I am making a conceptual mistake, but I am unable to identify it. Please shed some light.
If required, here is the full code:
function myFunction() {
  var input, filter, ul, li, a, i, txtValue;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  ul = document.getElementById("myUL");
  li = ul.getElementsByTagName("li");
  for (i = 0; i < li.length; i++) {
    a = li[i].getElementsByTagName("a")[0];
    txtValue = a.textContent || a.innerText;
    if (txtValue.toUpperCase().indexOf(filter) > -1) {
      li[i].style.display = "block";
    } else {
      li[i].style.display = "none";
    }
  }
}* {
  box-sizing: border-box;
}
#myUL {
  list-style-type: none;
  padding: 0;
  margin: 0;
}
#myUL li a {
  border: 1px solid #ddd;
  margin-top: -1px;
  /* Prevent double borders */
  background-color: #f6f6f6;
  padding: 12px;
  text-decoration: none;
  font-size: 18px;
  color: black;
  display: block
}
#myUL li a:hover:not(.header) {
  background-color: #eee;
}<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for a product.." title="Product Search" style="margin: auto; width: 80%;background-repeat: no-repeat;">
<ul id="myUL">
  <li style="display: none"><a href="#">phones</a></li>
  <li style="display: none"><a href="#">laptops</a></li>
  <li style="display: none"><a href="#">desktops</a></li>
  <li style="display: none"><a href="#">headphones</a></li>
  <li style="display: none"><a href="#">speakers</a></li>
  <li style="display: none"><a href="#">cameras</a></li>
  <li style="display: none"><a href="#">fridges</a></li>
</ul> 
     
     
     
     
     
    