0

How to align table

My table is not aligning to center. By default it is left aligned. It gets aligned to right from table tag but not gets center aligned. Is it not supported in HTML5. https://code.sololearn.com/WwNxu2eb63pT/?ref=app

20th Aug 2020, 1:32 PM
Dushyant Kumar Tyagi
Dushyant Kumar Tyagi - avatar
5 Respostas
+ 2
use css, center tag is obsolete. table{ margin:auto; }
20th Aug 2020, 1:38 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 2
You could use inline styles to set margin: auto. <table align="center" border-spacing="0" border="6" style="margin: auto"> Unrelated to your question, strongly consider the following: - It is nicer to use CSS instead of HTML's old formatting attributes. - Fix your invalid whitespace characters. Look at Sololearn's code editor and fix those dots. You shouldn't have any "x" marks in the code editor.
20th Aug 2020, 1:38 PM
Josh Greig
Josh Greig - avatar
+ 2
html5 aside. it seems that <center> are missing. but the closing tag </center> exist adding <center> before <table> should take it to the center even if its working, consider to move to current standard with html5 and css3.
20th Aug 2020, 1:42 PM
Rei
Rei - avatar
+ 1
Good . Thank! got it
20th Aug 2020, 1:41 PM
Dushyant Kumar Tyagi
Dushyant Kumar Tyagi - avatar
+ 1
That's correct. The centre tag was deliberately deleted to check wheather table tag's align="center" attribute works or not.
20th Aug 2020, 1:48 PM
Dushyant Kumar Tyagi
Dushyant Kumar Tyagi - avatar