Jump to content
Sunamena

CSS: Table in the center of the page

Recommended Posts

Hello, i am currently using this to make my table appear in the center.<table align="center">...When i look, it works, but the validator suggests to use CSS. I have tried some things like:<table style="align:center"><table style="text-align:center">But none of them seem to work.

 

 

What am i doing wrong?Thanks in advance! =D

Share this post


Link to post
Share on other sites

If the table has a specified width set the margin to "0 auto"

Share this post


Link to post
Share on other sites

If single table

<table id="table1">
Multiple
<table class="table01">
Between <head>....</head>
<style type="text/css">/* '.' Period is for class refefence '.table01', '#' for id reference '#table01' */.table01 { width:95%; margin: 0 auto; }</style>
or external style sheet, just
.table01 {width:95%; margin: 0 auto;}
Edited by dsonesuk

Share this post


Link to post
Share on other sites

<table style="align:center"> is not a valid definition

<table style="text-align:center"> is only for the text inside the table not the table itself.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...