Use the following steps to center align a button in a div container:
center
The button and all the contents within the div should now be center aligned.
Here is a working code example that can help you better understand the concept:
<html> <head> <style> div{ text-align: center; } </style> </head> <body> <div> <button>Enter</button> </div> </body> </html>
We can also implement a way in which to only center align the button.
Use the following steps to center align a button in the middle of a div container:
0 auto
block
The button should now be center aligned.
Here is a working code example that can help you better understand the concept:
RELATED TAGS
CONTRIBUTOR
View all Courses