views:

316

answers:

4

Take a look at this html page.

In Firefox it looks just like I want it to look, in IE it looks "a bit weird", and in Chrome it's all twisted.

What non-standard HTML I am using that makes it looks so different between browsers? Specifically, how can I fix the Chrome & IE versions to look more like Firefox?

Note that Chrome only goes haywire if all or almost all columns have the yellow stickies. If one or two columns are empty, then Chrome displays the page just like Firefox.

Edit - here is the fixed page.

A: 

Try validating your CSS and HTML if possible. That usually helps remove the biggest of glitches.

validator.w3.org

filip-fku
I fixed the validation and the problem is still happening.
ripper234
+2  A: 

One of the first things I'd have to suggest is making sure that your code is valid if you want cross-browser friendly.

The posted code comes up with 33 errors.

FF isn't quite as picky as some other browsers can be, and gives a lot of leeway in terms of valid code.

Try validating and fixing the problems with validity, then check it again; it might look at least a bit better.

Douglas
The problem is this is HTML generated by javascript. I saved a static snapshot of the HTML using Firefox, this must have corrupted the validity. The original rendered HTML is valid.
ripper234
There, I fixed the validation and it's still happening.
ripper234
A few of the more important things to be sure of are, as has been mentioned, that you make sure to include a DOCTYPE. Without one, browsers can hardly tell what it is they're looking at.Careful how you comment your code. One of the first errors which pops up states "document type does not allow element "h2" here". Even though it's in a comment, it can pop up in the browser as a point of interest. Some browsers try to "help" the developer by allowing for small missteps in coding, but that can move things around at times.
Douglas
You've also omitted a lot of end tags. Remeber the ending " />" in your self-closers.There are also a LOT of these: "Opening and ending tag mismatch: td line 479 and tr ".Try to look through and make sure that your javascript is opening AND closing elements.
Douglas
But I have fixed the validation. There is a doctype now, and I removed the relevant comments...
ripper234
Sorry, I was typing all that as you fixed it lol.Is it possible to post the full code with javascript and all? http://pastebin.com/
Douglas
The document that this question links to is now fixed.
ripper234
+2  A: 

The page doesn't have a DOCTYPE. It is important to have one to tell the browsers that your page is standards compliant. Start from there and ensure your page passes validation for your chosen DOCTYPE.

UPDATE: Good job on fixing the validation! Your problem now is that the table element follows two floated divs without any clearing. You must clear the floated elements so that the following elements are laid out correctly below them.

Try the following. Google "clearfix" for a more elegant solution.

<div style="float:left">....
<div style="float:right">....
<br style="clear:both"/>
<table ....
Chetan Sastry
I fixed the validation and the problem is still happening.
ripper234
@ripper234: See updated answer.
Chetan Sastry
Works like a charm, thanks!
ripper234
A: 

Float your calendar table to the left

Joe Philllips