I have developed a site for a local school. It's using my own CMS.

The pages are generated from a HTML template, which has an attached CSS File.

The CMS pulls some HTML for each page from a database, and inserts it into the template, and then uses PHP's htmltidy function to generate the output you see. Thus, the output is all generated the same way, using the same template, and using the same CSS file.

However, there's an odd display anomaly. The navigation bar is generated via a bulleted list, and on one of the pages, it displays how I'd like it to - the sub heading with the logo and chalk board is nested directly beneath the navigation bar.

On all the other pages, however, the sub header is not directly under the navigation bar. I can fix it by adjusting the CSS, but it throws out the single page, because it's out of whack.

What could be causing this discrepancy? I've looked over the page in Firebug, but that didn't show anything that jumped out at me.

Note: I also validated the page, and I noticed that a I had a target attribute stuck in my link on the single page. This caused HTML Tidy to tidy the document as transitional. I've overridden Tidy to use Strict, but I will remove the target attribute so the page validates.

2 answers

This was chosen as the best answer

Your Doctype on the correct page is Transitional and the rest it is Strict. That should fix it.

Answered about 10 years ago by Ben Shoults
  • Spot on! Thanks for pointing that out. For the reference of others who are having a similar problem, you can explicitly define the doctype used by HTML Tidy. http://tidy.sourceforge.net/docs/quickref.html#doctype EvilChookie about 10 years ago
Emily G 620

If you want to go with the Strict doctype add

#header img {vertical-align:bottom} 

Images default to vertical-align:baseline which leaves room for text descenders.

Answered about 10 years ago by Emily G
  • Thanks for the tip. I added this rule to my stylesheet, and now my site is behaving itself as it should (in conjunction with Ben's answer). Thanks! EvilChookie about 10 years ago