I have used a div and used margin:auto , but it does not work.
#up {
margin: auto;
display: block;
}
<div id="up">
<input type="file" name="fileToUpload" id="fileToUpload">
</div>
I have used a div and used margin:auto , but it does not work.
#up {
margin: auto;
display: block;
}
<div id="up">
<input type="file" name="fileToUpload" id="fileToUpload">
</div>
This is duplicate question, however:
You want the input to be centered? Then add text-align:center;
to the container div.
#up { margin: auto; display:block; }
#up { border: 1px solid blue; }
#alignCenter {text-align:center;}
#alignCenter {border:1px solid purple;}
/* To illustrate what is happening */
#fileToUpload {background:red;}
<div id="up">
<input type="file" name="fileToUpload" id="fileToUpload">
</div>
<div id="alignCenter">
<input type="file" name="fileToUpload" id="fileToUpload">
</div>