I am trying to set mutliple attributes to a form. I want the form to be centered and the background to be orange. But only the last attribute is executed. So in the code below the background color would be orange but the form would not be centered.
Here is my code:
<!DOCTYPE html>
<html>
<body>
<form id="form">
First Name:<br>
<input type="text" name="firstname">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
<script> alert("ahhhhhh");
var form = document.getElementById("form");
form.setAttribute("style", "background-color: orange");
form.style.align = "center";
form.style.backgroundColor = "orange";
</script>
</body>
</html>
Could someone tell me why this happens and how set mutliple attributes on one element? Thanks!