CSS way to horizontally align table

前端 未结 10 1167
礼貌的吻别
礼貌的吻别 2020-11-30 18:46

I want to show a table of fixed width at the center of browser window. Now I use

But Visual S

10条回答
  •  借酒劲吻你
    2020-11-30 19:22

    Although it might be heresy in today's world - in the past you would do the following non-css code. This works in everything up to and including today's browsers but - as I have said - it is heresy in today's world:

...

What you need is some way to tell that you want to center a table and the person is using an older browser. Then insert the "

" commands around the table. Otherwise - use css.

Surprisingly - if you want to center everything in the BODY area - you just can use the standard

text-align: center;

css command and in IE8 (at least) it will center everything on the page including tables.

提交回复
热议问题