How to align button in center in HTML without CSS
![](https://toastofcode.com/wp-content/uploads/2023/07/how-to-align-button-in-center-in-HTML-without-CSS-1280x700.png)
In HTML, buttons are used to trigger actions, submit forms, and navigate to different pages. However, aligning a button in the center of a webpage or container can be challenging without using CSS. In this article, we will explore different methods to align a button in the center of a webpage without using CSS.
Method 1: Using the tag
The tag is an HTML element that was used in the past to center align content on a webpage. While it is not recommended to use this tag anymore, it can be used to align a button in the center of a webpage. To use this method, you can wrap the button inside the tag.
Here is an example code snippet:
<center>
<button>Click me</button>
</center>
This method works well if you only have one button to align in the center.
Method 2: Using the tag
The tag is commonly used to create tables in HTML. However, it can also be used to align a button in the center of a webpage. To use this method, you can create a table with a single cell and add the button inside it. Then, you can set the alignment of the table to “center”.
Here is an example code snippet:
<table align="center">
<tr>
<td>
<button>Click me</button>
</td>
</tr>
</table>
This method works well if you have multiple buttons or other elements to align in the center.
Method 3: Using the tag with text-align property
The tag is commonly used to create containers in HTML. To align a button in the center of a webpage using this method, you can create a container and add the button inside it. Then, you can set the text-align property of the container to “center”.
Here is an example code snippet:
<div style="text-align:center;">
<button>Click me</button>
</div>
This method works well if you want to align a button in a specific position on the webpage.
In conclusion, while using CSS is the recommended method to align a button in the center of a webpage, there are several ways to achieve this without using CSS. You can use the tag, tag, or tag with the text-align property depending on your requirements. However, it is essential to note that using CSS is the preferred method as it provides more control and flexibility over the design.