[GLLUG] Off Topic - Please, HTML/CSS problem, any help?

Richard Houser rick at divinesymphony.net
Tue Mar 6 20:36:45 EST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan Ryan wrote:
> Oh man will you kick yourself when I tell you what was causing the problem. 

It sounds like you weren't using all the validation W3C has to offer.
If you are using CSS, you really should be using the CSS validation tool
as well.  As far as JavaScript (and in general), I would recommend you
do all your testing on Firefox, then make sure it works on IE.  The
script console is a heck of a lot better than a text box that shows the
wrong source file for the wrong line number that caused only the first
error.

If Firefox did accept a value missing a px, that should be reported to
mozilla.org.  The specification clearly states that a parse error on
something like that means the entire rule should be ignored.  In this
case, IE7 may be doing something right when Firefox is failing (/ducks
the incoming chair).  It is very likely that this might already be fixed
in the latest Gecko.  If you are in quirks mode, however, that is
probably intentional.  One of the dialogs (page info I think), should
show quirks, or standards compliant mode.

On that note, I'm fairly certain that your doctype isn't considered
valid by all browsers.  ALL new development should be using at least
XHTML 1.0 strict (only 1.1 if you can do without text/html mime type, if
you can't, you need to use the html compatibility subset as well), and
polishing of old code should really be to 4.01 strict.  I think this
doctype will trigger some quirksmode issues on some browsers, but you
really need to check per-browser.  You don't get "safe" from those
issues until 4.01 strict or something in the XHTML sphere.


A few additional best-practices for you (I debug/fix a lot of web code
as part of my job):

Don't embed CSS into html, php, jsp, etc. files.  It is a bad practice
and will cause you grief later.  Always pull them out to an external
file, even if it is only used on a single file.

NEVER embed JavaScript code into your content files.  In addition to
being wrong just like with css, there are several characters required
for most scripts (& for example) that are not valid inside HTML/XHTML
documents.  This also goes for events such as onclick, onchange, etc.
If you need those, dynamically register the handlers based on window.onload.

Don't link to content files with the file extension.  I noticed you had
links to a bunch of html files.  If you want to link to poetry.html, use
just poetry.  HTTP supports content negotiation, and this should be used
to match the request, not relying on that exact file.  If you swap to
php or something later, you will have a huge mess on your hands.  I did
check: your host has something configured wrong, as content negotiation
is not working.  I recommend you check into it.  The change should be
trivial for your provider.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFF7hctUMkt1ZRwL1MRAijUAJ9uIP8CMjwiRgfszpREpDm3dmhHcACfRP9r
WONbLeysR0/8tUpAnC5l2Go=
=HbIs
-----END PGP SIGNATURE-----


More information about the linux-user mailing list