can't center anchor tag in table

liunx

Guest
I have a class called Essay that centers a table:

table.Essay
{
margin-left:9%;
margin-right:9%;
}

One of the td's is a link.I am trying to center this, but it won't center. I have:

.Essay a
{
color: #000000;
font-size: 16px;
text-align: center;
}

.Essay a:link
{
color: #333333;
}

.Essay a:hover
{
color: #000066;
}

.Essay a:active
{
color: #000000;
}

.Essay a:visited
{
color: #333333;
}

I don't want to use:

.Essay td
{
text-align: center;}

as it would center all the other table data - i just want the link centered. What am i doing wrong?Put the text-align: center in .Essay a:linkthat doesn't work either.

:confused:Try:
.Essay td a:link
{
display: block;
color: #333333;
text-align: center;
}that doesn't work either.

:confused:hmm not sure where the above post came from, must've refreshed the page or something.

but yes fang thats got it working, thanks for your help :D<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>center link in table</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
table.Essay
{
margin-left:9%;
margin-right:9%;
}
.Essay a
{
color: #000000;
font-size: 16px;
}
.Essay a:link
{
display: block;
color: #333333;
text-align: center;
}
.Essay a:hover
{
color: #000066;
}
.Essay a:active
{
color: #000000;
}
.Essay a:visited
{
color: #333333;
}
-->
</style>

</head>
<body>
<table class="Essay" border="1" cellpadding="0" cellspacing="0" summary="">
<tr><td><a href=http://www.webdeveloper.com/forum/archive/index.php/"http://www.mysite.com">apple</a></td></tr>
<tr><td>banana</td></tr>
<tr><td>cranberry</td></tr>
</table>
</body>
</html>
 
Back
Top