Welcome Guest [Log In] [Register]
We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Multiquote (on) Multiquote (off)
Add Reply
website maker - centre align coloums?
Topic Started: Aug 16 2011, 11:40 AM (1,464 Views)
kevsrfc
Member
[ * ]
Hi,

Please refer to the enclosed screengrab and advise how I can centrally align all of the columns apart from the leftmost one.

Is there some aspect of the theme CSS which is over-riding the alignment in the HTML code as it looks ok to me ???

Here's my HTML code ...

<HTML><HEAD><TITLE>Stats</TITLE></HEAD><BODY>
<TABLE border="1" WIDTH="100%">
<CAPTION><B>Stafford Rangers FC - Season 2011/12 Player Statistics</B></CAPTION>
<COLGROUP WIDTH="40%"></COLGROUP>
<COLGROUP ALIGN="CENTER" WIDTH="10%" SPAN=6></COLGROUP>
<TR><TH rowspan="2"><TH colspan="2">LEAGUE<TH colspan="2">CUP<TH colspan="2">TOTAL
<TR><TH>games<TH>goals<TH>games<TH>goals<TH>games<TH>goals
<TR><TD>Glyn Blackhurst
<TD>1<TD>0<TD>0<TD>0<TD>1<TD>0

.... snip (loads of lines similar to the above two) ....

</TABLE></BODY></HTML>

Posted Image <--click to enlarge
Edited by Helena, Aug 31 2011, 12:16 AM.
Offline Profile Quote Post Goto Top
 
Liam
Member Avatar
~

I'm not expert with HTML, but I simply added <center> before each individual field and it worked for me. :P

I know it is requires more effort and will increase the size of the code quite significantly, but it works!

Liam
Online Profile Quote Post Goto Top
 
Helena
Member Avatar
M is for Mod

you can center those columns by adding this bit of code to either the top or bottom of your web page:

Code:
 
<style type="text/css">
td, th {
text-align: center;
}

td:first-child {
text-align: left;
}
</style>


Online Profile Quote Post Goto Top
 
Quozzo-ZNS
Member Avatar
Member
[ *  * ]
The <centre> tag is depreciated (although every browser still knows what it does, it won't validate, if your bothered about that) so i would use Helena's code.
Offline Profile Quote Post Goto Top
 
Minato-ZNS
Member Avatar
Someday the Dream Will End
[ *  *  * ]
Helena
Aug 31 2011, 12:13 AM
you can center those columns by adding this bit of code to either the top or bottom of your web page:

Code:
 
<style type="text/css">
td, th {
text-align: center;
}

td:first-child {
text-align: left;
}
</style>


The only problem with that is that it'll center everyone of the tables that have a TD or a TH in them. For the snippet that was presented, put align="center" after every TD or TH that you want centered. This way, it doesn't do anything to the rest of the forums.
Offline Profile Quote Post Goto Top
 
Helena
Member Avatar
M is for Mod

It would do that if the snippet (without style tags) was added to the main CSS of the board. But since this is on a ZB webpage, it won't affect the forums, only the coding on the web page.


Adding it to the webpage will make it affect the table cells on the webpage only. It will center the text in all columns except the first one, which I believe is what the user requested, and it works on a test board.
Online Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards - Theme & Code Support · Next Topic »
Add Reply