Jump to content

Questions about <table>


Renegade605

Recommended Posts

Validation PageI have two questions about the use of the <table> tag in HTML. Both can be seen on that validation screen.First, the ALIGN attribute is not allowed in HTML 4.01 Strict, how can I get my table to align to the center without using that. I tried using inline styles two ways:
  • style="text-align: center;"
  • style="align: center;"

But neither of those work, what is the correct way.Second:

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element. One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>"). Line 544, column 21: document type does not allow element "TABLE" here; missing one of "OBJECT", "MAP", "BUTTON" start-tag <table align="center">
What does that mean, and how do I fix it?Thanks,Renegade, Lieutenant General-=[TUF]=- The United Frontwww.theunitedfrontclan.com
Link to comment
Share on other sites

You may have put the <table> tag within an inline element, let me take a look.If you want to center align something in your table you can put the style on the <tr>, <th> or <td> tags:<td style="text-align: center">or make the table like this:<table id="something">and add this CSS:table#something td {text.align: center}EDITYou seem to be putting the <table> inside an <h2> element. I'm not sure that's allowed.And I just thought I may have misunderstood what you wanted with aligning. To align the whole table to the center put it inside a container, like this:<div style="text-align: center"><table>...</table></div>

Link to comment
Share on other sites

I do know that you can set the 'text-align' style on the <td> tags. I didn't know that when I first wrote the page, and just haven't gotten around to fixing it yet. But it's probably good that you point it out.As for putting a <table> inside <h2>, something must have gone wacky inside my head when I wrote that...Thanks for the help,Renegade, Lieutenant General-=[TUF]=- The United Frontwww.theunitedfrontclan.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...