By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,624 Members | 2,229 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,624 IT Pros & Developers. It's quick & easy.

How should get table centered?

P: n/a
Hi,

I'm trying to do align table center in CSS like this. But it doesn't
work.

..tx-gooffotoboek-pi1 table {
text-align: center;
}

I can do <table align="center"but it's said deprecated. Hence the
how to center table question.

Thanks in advance for any help.

Bing

Apr 3 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 2007-04-03, du****@gmail.com <du****@gmail.comwrote:
Hi,

I'm trying to do align table center in CSS like this. But it doesn't
work.

.tx-gooffotoboek-pi1 table {
text-align: center;
}

I can do <table align="center"but it's said deprecated. Hence the
how to center table question.

Thanks in advance for any help.
..tx-gooffotoboek-pi1 table { margin-left: auto; margin-right: auto; }
Apr 3 '07 #2

P: n/a
du****@gmail.com wrote :
Hi,

I'm trying to do align table center in CSS like this. But it doesn't
work.

.tx-gooffotoboek-pi1 table {
text-align: center;
}

I can do <table align="center"but it's said deprecated. Hence the
how to center table question.

Thanks in advance for any help.

Bing

Using Web Standards in your Web Pages
Section 2.2.3.2 I use <centeror align="center". How to align with CSS?
http://developer.mozilla.org/en/docs...your_Web_Pages

The CSS1 text-align property specifies how text or inline elements (like
an image) are aligned within an element.

CSS "margin-left: auto; margin-right: auto;" properties will center a
block-level element within its containing block. Defining margin-left
and margin-right is for block-level elements. When both margin-left and
margin-right are auto, they are set to equal values, thus centering a
block-level element within its parent.

References:
CSS1 horizontal formating
http://www.w3.org/TR/REC-CSS1#horizontal-formatting

Worth mentioning is the excellent tutorial:
Centring using CSS by D. Dorward
http://dorward.me.uk/www/centre/

Also Interactive demo on CSS horizontal alignment and horizontal formating
http://www.gtalbot.org/NvuSection/Nv...Alignment.html

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
Apr 3 '07 #3

P: n/a
On Apr 3, 6:27 pm, Gérard Talbot <newsblahgr...@gtalbot.orgwrote:
dub...@gmail.com wrote :
Hi,
I'm trying to do align table center in CSS like this. But it doesn't
work.
.tx-gooffotoboek-pi1 table {
text-align: center;
}
I can do <table align="center"but it's said deprecated. Hence the
how to center table question.
Thanks in advance for any help.
Bing

Using Web Standards in your Web Pages
Section 2.2.3.2 I use <centeror align="center". How to align with CSS?http://developer.mozilla.org/en/docs...s_in_your_Web_...

The CSS1 text-align property specifies how text or inline elements (like
an image) are aligned within an element.

CSS "margin-left: auto; margin-right: auto;" properties will center a
block-level element within its containing block. Defining margin-left
and margin-right is for block-level elements. When both margin-left and
margin-right are auto, they are set to equal values, thus centering a
block-level element within its parent.

References:
CSS1 horizontal formatinghttp://www.w3.org/TR/REC-CSS1#horizontal-formatting

Worth mentioning is the excellent tutorial:
Centring using CSS by D. Dorwardhttp://dorward.me.uk/www/centre/

Also Interactive demo on CSS horizontal alignment and horizontal formatinghttp://www.gtalbot.org/NvuSection/NvuWebDesignTips/HorizontalAlignmen...

Gérard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)http://developer..mozilla.org/en/doc...s_in_your_Web_...
Excellent. That just did what I expected. Thanks guys for lending a
helping hand. Really appreciated it!!!

Bing

Apr 4 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.