PDA

View Full Version : site looks weird in IE, and doctype causes line spacing issues.



nstone01
Jan 14th, 2009, 12:51 AM
hi.

so i'm responsible for maintaining/updating a website: http://www.magnoliaeditions.com.

when i declare doctype as:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
, the left hand navigation sidebar is sized correctly and everything looks good -- but all text in the body is double spaced.

when i declare doctype as:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> , everything on the page moves down and to the right in IE, and the line spacing on the left hand navigation sidebar is enlarged... but all the text in the body is spaced correctly.

when declaring 4.01, the double spacing in the body text occurs on safari/IE/whatever. when declaring 3.2, the down-and-to-the-right & enlarged-line-spacing-on-the-sidebar issues are only issues in IE, not other browsers.

i've tried adding an <!--[if IE]> statement which links to a different stylesheet. this improved the line spacing issue on the navigation sidebar but doesn't solve my issue with the double spacing on the body text when declaring 4.01, since it's not an IE-specific problem.

here's my test page with the <!--[if IE]> statement:

http://www.magnoliaeditions.com/Content/NewPub/NewPub_IE.htm
compare to: http://www.magnoliaeditions.com/Content/NewPub/NewPub.htm

my usual stylesheet is at http://www.magnoliaeditions.com/Content/magnolia.css
my modified-for-IE stylesheet is at
http://www.magnoliaeditions.com/Content/magnolia_IE2.css

sorry if i haven't explained this very clearly. hopefully if you look at my HTML and/or CSS it may get clearer. if you are running IE on windows, you can see the difference between the 3.2 and 4.01 doctypes by comparing these two pages:
http://www.magnoliaeditions.com/Home.htm
http://www.magnoliaeditions.com/Content/NewPub/NewPub.htm

so in sum: if i declare doctype 3.2, the page moves around & navigation panel looks messed up in IE but the body text is spaced correctly.
if i declare 4.01, which seems to be the most accurate doctype, the page aligns correctly & navigation looks good, but the body text gets double spaced.

any advice would be much appreciated.

thanks, NS

twodayslate
Jan 14th, 2009, 01:09 AM
Please use the code tag and validate your code
http://validator.w3.org/

nstone01
Jan 14th, 2009, 02:29 AM
ok, thanks for the advice! i am working on validating. i've gotten Home.htm and Index.htm 100% valid. i guess the folks who made the website weren't familiar with the w3c... sigh. gotta basically remake the entire site to validate the rest. i'm on it...

in the meantime, any advice on my issue is much appreciated. i don't think validating is solving it, although it is certainly helping to expunge a lot of faulty and unnecessary coding.

thanks,
NS

twodayslate
Jan 14th, 2009, 03:29 AM
ok, thanks for the advice! i am working on validating. i've gotten Home.htm and Index.htm 100% valid. i guess the folks who made the website weren't familiar with the w3c... sigh. gotta basically remake the entire site to validate the rest. i'm on it...

in the meantime, any advice on my issue is much appreciated. i don't think validating is solving it, although it is certainly helping to expunge a lot of faulty and unnecessary coding.

thanks,
NSwhile you are recoding the site, make it frameless/tableless?

font is not a supported tag

tomws
Jan 14th, 2009, 03:30 AM
Well, a good starting point would be to pick a doctype and stick with it. Kind of difficult to debug a combination of doctypes, but then doing it in IE just makes it unpleasant. I vote go with HTML 4 if you're just selecting between those two.

Some of the display problems may be coming from the layout tables being handled differently and all that extra tag soup related to those. It doesn't look like a complex layout so the whole thing could probably be re-coded with less effort than patching up what's there.

drhowarddrfine
Jan 14th, 2009, 05:02 AM
For new web pages there is no question which doctype to use.

nstone01
Jan 19th, 2009, 09:01 AM
For new web pages there is no question which doctype to use.
okay. would you mind sharing which doctype that might be? thanks.

abduraooft
Jan 19th, 2009, 09:17 AM
okay. would you mind sharing which doctype that might be? thanks.
I'd recommend a Strict HTML DOCTYPE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

Arbitrator
Jan 19th, 2009, 09:43 AM
I'd recommend a Strict HTML DOCTYPE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">nstone01, you can shorten this up a bit: <!doctype html public "-//W3C//DTD HTML 4.01//EN">.

nstone01
Jan 19th, 2009, 11:30 PM
ok thanks very much, both of you!!

drhowarddrfine
Jan 19th, 2009, 11:44 PM
nstone01, you can shorten this up a bit: <!doctype html public "-//W3C//DTD HTML 4.01//EN">.

Two things. DOCTYPE must be in uppercase and that version of the DTD is not the correct version. From the W3C web site: (http://www.w3.org/QA/2002/04/valid-dtd-list.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

nstone01
Jan 20th, 2009, 12:00 AM
thank you dr!

Excavator
Jan 20th, 2009, 03:10 AM
This spacing problem your having with different doctypes and browsers may be cured by adding *{margin:0;padding:0;} to your CSS and then specifying the margin you want on your text.
This would do away with defaults which are different from browser to browser.

Arbitrator
Jan 20th, 2009, 08:06 PM
Two things. DOCTYPE must be in uppercase and that version of the DTD is not the correct version. From the W3C web site: (http://www.w3.org/QA/2002/04/valid-dtd-list.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">Incorrect.

Document type declarations keywords (i.e., doctype, public, and system) and element names (e.g., html) are only case‐sensitive in XML (uppercase). In HTML, the case of the keywords and element names are irrelevant.

As for the URI, again, that is only required for XML documents. In XML, you can actually make this even shorter though and omit the document type declaration entirely unless you want to use the character entity references.

(When you do use the URI, ideally, youíd want to point it at a DTD hosted on your own server. If browsers actually used the thing, the billions of Web pages that donít do this would crash the W3Cís Web site with DTD requests; this demonstrates how pointless the URI really is.)