Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS Table Problem

Status
Not open for further replies.

altendew

Programmer
Mar 29, 2005
154
US
Code:
.body, .content, .content TABLE, .menu
{
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
}

.body, .content
{
	color: #000000;
}

.content TD
{
	background-color: #F0F0FF;
}

.content a
{
	color: #0000FF;
	text-decoration: none;
}

.content TABLE, .content TH
{
	background-color: #4482FF;
}

.content TH a
{
	color: #FFFFFF;
	text-decoration: none;
}

I am currently using that code to format this table..

Code:
<div class="content">
<table cellpadding="0" cellspacing="1" border="0">
   <tr>
     <th>Header 1</th>
   </tr>
   <tr>
     <td>Body 1</td>
   </tr>
   <tr>
     <td>
        <table cellpadding="0" cellspacing="0" border="0">
          <tr>
            <td>Body 2</td>
          </tr>
        </table>
     </td>
   </tr>
</table>
</div>

The problem is body 2 loses its formatting, because I do not have a .content TD TD set up, well I can not determine how many tables I will have inside each other.. is there a way to make it go in the other tables. I can not include anything else in the HTML code.. the only thing I can edit is the CSS.

Thanks,
Andrew
 
Well - maybe you have no open or close body or html tags (we don't know because you're not showing us)... or maybe you're using Uncle Bob's browser 0.9 Beta (again, we don't know because you don't tell us)... but whatever - the code works for me in both IE 6/Win and Fx1.5.0.2/Win when I wrap the code you gave in a correctly structured document:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<meta http-equiv="content-language" content="en">
	<title>Table test</title>
	<style type="text/css">
		.body, .content, .content TABLE, .menu {
			font-family: Verdana, Arial, Helvetica, sans-serif;
			font-size: 12px;
		}

		.body, .content {
			color: #000000;
		}

		.content TD {
			background-color: #F0F0FF;
		}

		.content a {
			color: #0000FF;
			text-decoration: none;
		}

		.content TABLE, .content TH {
			background-color: #4482FF;
		}

		.content TH a {
			color: #FFFFFF;
			text-decoration: none;
		}
	</style>
</head>

<body>
	<div class="content">
		<table cellpadding="0" cellspacing="1" border="0">
			<tr>
				<th>Header 1</th>
			</tr>
			<tr>
				<td>Body 1</td>
			</tr>
			<tr>
				<td>
					<table cellpadding="0" cellspacing="0" border="0">
						<tr>
							<td>Body 2</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Its because I did not specify the doctype.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top