td align="right" and Mozilla

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

td align="right" and Mozilla

Post by nigma »

Hey,

Anyone know how to get it so that <td align="right">RIGHT TEXT</td> will work when viewed in mozilla?

thanks
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Try this and see what you get:

Code: Select all

<table border="1">
<tr>
	<td align="right">RIGHT TEXT</td>
</tr>
<tr>
	<td align="right">RIGHT TEXT (LONGER TEXT)</td>
</tr>
</table>
Regards,
Scorphus.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

I currently have:

Code: Select all

<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>LEFT TEXT</td>
<td align="right">RIGHT TEXT</td>
</tr>
</table>
Doesn't seem much diff except that new table row.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Hmm... I had made tables display inline in my stylesheet. Changed that and it worked.

Anyone know why making a tables display inline would make
<td>'s with the align property not work in mozilla?
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

nigma wrote:...Doesn't seem much diff except that new table row.
Just a longer td content, so you can see the right alignment effect.

This piece of code worked in Mozilla:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Test</title>
	<style>
	table &#123;
		display : inline;
	&#125;
	</style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
    <td>Test, just a test</td>
    <td align="right">Testa gain</td>
</tr>
<tr>
    <td align="right">Test and test</td>
    <td>It's all about test</td>
</tr>
</table>
</body>
</html>
Regards,
Scorphus.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Maybe it's because I was using Strict.dtd instead of transitional? Also I was using the table inside a few divs, so that could have effected things?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Mixing up tables and CSS for layout can cause problems - as you've discovered.
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

It shouldn't... they are in no way incompatible.

That said, however, I have run into issues in the past getting text-align: right; to work in Mozilla. I don't think I ever figured out why.
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

I don't think it has something to do with doctype.

But "...inside divs", maybe. Post your code. Let us take a look to it.

Regards,
Scorphus.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Set width's for each td.
Image Image
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>nigma @ nigmaNET</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>

<div id="container">
<h1 class="pageheader"><span>NigmaNET</span></h1>
  <div id="navigation"><a href="#">BLOG</a><a href="#">Contact</a></div>
  <div id="mainContent"> <br />
    <p>Here is a test paragraph.<p>
  </div>
  <div id="footer">
  <table width="100%" border="0" cellpadding="0" cellspacing="1"><tr><td>
    &copy; 2003 Nigma. All Rights Reserved.</td><td align="right">
    <span style="text-align: right; margin-left: 5px">Design by <a href="http://www.urbanchaos.net">www.urbanchaos.net</a></td></tr></table>
  </div>
</div>
</div>

</body>
</html>
CSS Part for table

Code: Select all

#footer table &#123; display: inline &#125;
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

I'm getting things right-aligned here, using Mozilla Firebird 0.6
I've added one row to the end of the table:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>nigma @ nigmaNET</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style2.css" />
</head>

<body>

<div id="container">
<h1 class="pageheader"><span>NigmaNET</span></h1>
  <div id="navigation"><a href="#">BLOG</a><a href="#">Contact</a></div>
  <div id="mainContent"> <br />
    <p>Here is a test paragraph.<p>
  </div>
  <div id="footer">
  <table width="100%" border="1" cellpadding="0" cellspacing="1"><tr><td>
    &copy; 2003 Nigma. All Rights Reserved.</td><td align="right">
    <span style="text-align: right; margin-left: 5px">Design by <a href="http://www.urbanchaos.net">www.urbanchaos.net</a></td></tr><tr><td>
    ...All Rights Reserved.</td><td align="right">
    <span style="text-align: right; margin-left: 5px">Design by...</td></tr></table>
  </div>
</div>
</div>

</body>
</html>
The text is right-aligned but it expands to the entire <td> so you don't see the alignment.

No changes were made to the CSS...

Hope that helps.

Cheers,
Scorphus.
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

Sure does man, I apreciate it. Jesse I love these damned forums!
Post Reply