Forum Moderators: open

Message Too Old, No Replies

doctype problem

when remove shows something different

         

burn3r

6:17 am on Dec 22, 2008 (gmt 0)

10+ Year Member



my tables get expanded in firefox when i use the followin code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<link href="themes/swamp/style.css" rel="stylesheet" type="text/css">

<table width="242" border="0" cellpadding="0" cellspacing="0">
<tr><td><img src="themes/swamp/images/lnav-topHL.png" width="242" alt="Login"></td></tr>
<tr><td background="themes/swamp/images/lnav-top2.png" height="120"><form method="POST" action="">
<table width="242" height="120">
<tr><td width="86" height="2" align="right"><p><b><br><span class="memberbar">User:</span></b></p></td>
<td width="162"><p><br><input type="text" name="username" size="11" maxlength="15"></td></tr>
<tr><td height="5" align="right"><p><b><span class="memberbar">Pass:</span></b></p></td>
<td><input type="password" name="password" size="11" maxlength="15"></td></tr>
<tr><td height="60"></td><td><input type="submit" name="login" value="Login"></td></tr>
</table></form>
</table>

but once i remove

"http://www.w3.org/TR/html4/loose.dtd"

my tables align like i see them in dreamweaver.
wat i can do to fix my table when using full doctype?

oddblob

10:56 am on Dec 22, 2008 (gmt 0)

10+ Year Member



I think it might be to do with the actual doctype. Have you tried changing to Strict or Frameset? That affects how your page is handled.

burn3r

4:07 pm on Dec 22, 2008 (gmt 0)

10+ Year Member



i have tried all doctypes they all make my table look wierd and im sure my code is correct it only does in firefox cause in ie everything looks like intended to look with the full doctypye

tedster

6:37 pm on Dec 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. What do you mean by "my tables get expanded"?

2. The code you pasted in has no <head></head> section, and it also refers to a .css file that may be part of the picture.

I'd suggest first using the validators at the W3C. It's extremely important to be working with valid code when trying to fix rendering problems. Without that, you can just spin your wheels, since ever browser has different error recovery routines.

W3C Validator - HTML [validator.w3.org]
W3C Validator - CSS [jigsaw.w3.org]

burn3r

8:17 pm on Dec 22, 2008 (gmt 0)

10+ Year Member



its cause its a part of my code not the full it will be to long to post here and ive used the validator already and thers nothing wrong with my code that only happens with firefox. internet explorer displays it like i see them in dreamweaver

oddblob

9:18 pm on Dec 22, 2008 (gmt 0)

10+ Year Member



I'm afraid that is part of web design you need to accomodate for all browsers. I suggest making 2 style sheets for firefox and IE and experimenting with what works and what does not for each browser.

burn3r

10:30 pm on Dec 22, 2008 (gmt 0)

10+ Year Member



il just remove the http://www.w3.org/TR/html4/loose.dtd much simpler

[edited by: tedster at 1:09 am (utc) on Dec. 23, 2008]
[edit reason] de-link the url [/edit]

swa66

12:04 am on Dec 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure for nested tables been years since I touched that, but in general for the CSS part:
If FF and IE disagree on how to render things: it is nearly always -if not fully always- FF that renders it correct and IE that's way out there (even if IE renders it as what you want to happen, it might not be what your CSS instructs the browsers according to standards).

piskie

12:19 am on Dec 23, 2008 (gmt 0)

10+ Year Member



As you are already using CSS, try styling your table for width and border.

commanderW

4:03 am on Dec 25, 2008 (gmt 0)

10+ Year Member



I recently had a cross-Browser problem because of using the "loose" doctype.

It was caused because this DTD allows you to leave certain tags unclosed, like the <p> and <li>. browsers 'assume' that the last one is closed when a new one starts. I accidentally left the closing bracket off an <hr> and every browser but IE treated the page as if <hr> was properly closed.
(Note: I have had other problems in which it was firefox that was the oddball, too.:-)

I solved mine by pouring over my own code till I spotted an error. I'm not practiced with tables however.

But here is a troubleshooting suggetion i just came up with (based on the above experience) that might help.

Change your doctype to html 4.01 strict. Then use the w3c validator. All unclosed tags and other errors that are allowed in the "loose" doctype will be flagged. Correct them all. See what happens. You may then be able to revert to the "loose" doctype if you need to.

The idea here is that, because the transitional "loose" doctype uses browser interpretation to fill in left out code, there is room for differences. (the treatment of the <hr> tag and it's missing bracket, a case in point.). If you have accidentally left an error in your code that is being adjusted to by most of the browsers (except in this case firefox), it will be revealed.

I'm pretty green at this, so I'll be really curious to know if this actually helps you figure out the problem.

[edited by: commanderW at 4:06 am (utc) on Dec. 25, 2008]

g1smd

4:01 pm on Dec 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Some of your code is way over-complicated:

<p><b><span class="memberbar">Pass:</span></b></p>

No need for the bold tags. You can add the bold styling to your stylesheet.

No need for the span tags, you can add the style name to the paragraph tags -- in fact, if there are multiple cells needing that style name, you might be able to add it (just once) to the table row or table tag and use this notation to style it:

table.memberbar tr td p { ....; }

There's also no need for <br> tags, you should use CSS to style the top or bottom margin of the paragraph.