Some advice to those who haven't dabbled before - as an addition to the last post -
The majority of page-breaking errors I see when I'm troubleshooting someone else's code, whether here or professionally (or mine own, for that matter) are small things - unbalanced or badly nested tags, and missing quotes, slashes or brackets. It's decieving how important this is, since in many browsers, some bad syntax is forgiven, while others choke on it and spit it out horribly rendered.
You can use an online syntax checker or validator, but validation is a complex subject, and if you check your code with an online tool (this W3C validator or this HTML syntax checker for example) chances are it will find lots of tiny things that don't won't effect how the page appears in any browser, and you'll have a hard time trying to figure out what to fix. However, these tools will help you find basic code typos.
Before you tear out your hair and retreat to the default template, check the basic structure of the code.
Are all the div's and p's balanced? Are they nested correctly? Do they all have a beginning and an ending tag? Tags can contain other tags, but they must end after the contained tag ends.
In other words:
≤div>≤p≥Hello≤/div≥≤/p≥
is wrong.
Do all your URLs (addresses in links AND in image tags) have quote marks surrounding them?
Are all brackets and slashes in place where they should be?
Some browsers ignore such little things, but others react violently. So the page may look fine to in your browser, but it could be throwing temper tantrums in some one else's.
The basic syntax of your code really needs to be tight as a drum before you go messing with margins, floats, clears or other complex issues to try to fix cross-browser issues.
This post was written by Paul from KIPlog
2 comments:
Thanks again to both of you for this info. The amazing part was that even though I have done very little code dabbling (anything fancy on my blog or recipe index is done by my very talented brother), I actually understood most of what you said.
hey I have worked on someone's else codes that have mistakes and it takes so much time to check what is wrong, so this HTML syntax checker will save a lot of time for me, thanks A LOT!
Post a Comment