Forum Moderators: open
I still need to support NN4 for several clients, but I want to go with the most up-to-date and valid code that I can write. So I'm in hybrid land with lots of CSS, but the occasional layout table in addition to absolutely positioned divs. I try for valid code (layout tables do validate after all) but most of all, I need to be pragmatic.
I had a pretty sweet template, it performed well in all browsers, so I was just cranking out the pages. I did a routine browser test on a minor font size issue, and all of a sudden saw that NN4 was messing up the position of an absolutely positioned div.
I went to other pages, and most of them rendered just fine but a few had the same problem. Same template, just different text!
As I pokde around, I began to see a pattern - all the incorrectly positioned pages had bulleted lists <ul>. After some more poking, I did an experiment. The lists all appeared within a set of <p></p> tags. But if I closed the paragraph before the list began, instead of including the list, then the page rendered just fine.
Who would have thought?
In fact, I can still see it both ways. These paragraphs were like this - "Here are some of the services we offer:" followed by a bulleted list. From a meaning-based point of view, the list seemed like part of the paragraph to me. I never gave it a thought.
I now see that lists need their own font declarations in CSS [unless they're illegally inside a paragraph ;)] so it's clear that HTML structure considers a list to be a different critter than a paragraph.
The W3C validator picks up this error, but Homesite/CSE did not. It's just growing pains for me. I never used </p> tags before this project.
In this case, because the </p> is not required except in XHTML, it got very fuzzy for me (and apparently for Homesite and CSE).
The W3C Validator said "</p> tag found when the <p> tag is not open" - something like that anyway. So apparently the minute a <ul> or <ol> tag comes along the <p> tag is assumed closed, just as it would be if another <p> tag were encountered.
Live and learn - I won't do that again. A very painful 4 to 5 hours. Still, what a surprising thing to see the absolute position of the div change as a result!
But seriously, I solve the problem by using TIDY set to XHTML, it makes certain I don't leave any opened tags...
Not much gets past TIDY for the W3C Validator to catch, though I have a few scars from when I got cocky and thought, "Sure, it's valid!" Which usually occured after I went back and made "quick" changes to the page code.
Tidy can also be customized (American English spelling - see other thread) through a simple text editor. You can modify spacing and indents as well as just about everything else.
- papabaer