+ 1

Centering a table

How do you center an entire table in CSS

4th Apr 2023, 4:21 AM
Sergio Gonzalez
Sergio Gonzalez - avatar
2 Respuestas
+ 1
To center an entire table in CSS, you can use the following code: table { margin: 0 auto; } This code sets the left and right margins of the table to "auto", which centers the table horizontally within its parent container. Alternatively, you can also use the following code: table { display: block; margin: 0 auto; } This code sets the display property of the table to "block", which allows it to have a width and height, and then centers it horizontally using the "margin" property as in the previous example. Keep in mind that the parent container of the table must have a set width for the above code to work properly.
4th Apr 2023, 4:24 AM
don't be sad 😶
don't be sad 😶 - avatar
0
<table align=“center”> … </table>
4th Apr 2023, 10:34 AM
Yousif R Wali
Yousif R Wali - avatar