0
Can someone help me with the answer to align the table to the center of the page. Can I get some help on this.
I need help for the answer to align the table to the center of the page for html. I have, <html> <head><title>My page</title>< > <body> <table =" "> <tr><td> <ul> <li>item</tr> < > (THIS PART IS BLANK NEED THIS ANSWER) </html>
3 Respuestas
0
I think what you mean is:
#HTML
<html>
<head>
<title>My Page</title>
</head>
<body>
<table>
<tr>
<td>
<ul>
<li>Item</li>
</ul>
</td>
</tr>
</table>
</body>
</html>
#CSS
table {
display: block;
width: 20%;
margin: 0 auto;
}
0
Set this table style:
margin : auto
0
You need to use CSS to do this, margin: auto works sometimes and it depends on the browser also, I have a few tips to keep a table centered.
table.center {
margin-left: auto;
margin-right: auto;
}
This is amazing and extremely useful, text-align:center; use to work but now with recent changes to browsers and such its better to have margin-left/right auto.
Also when you begin to dive into HTML5 this code will come in handy for keeping a table center without it messing with section/nav
@media only screen
and (min-device-width: 480px)
and (min-width: 700px)
{
section {
float: left;
width: 70%;
}
nav {
float: left;
width: 15%;
}
}