Forum Moderators: open
Now, not one single page has a DOCTYPE and I want to rectify this situation.
I know it will be messy with lots of code blood spilt liberally everywhere...I already had a peek at one page with the DOCTYPE added and it was very nasty!
what is the least painful way to go about this? I want good clean code with, as an absolute minimum, that it looks the same in IE, FF and Opera.
What prompted me this evening was finding out that all my css class="1" statements were showing fine in IE but not at all in FF. w3c says you shouldn't use numerals in class selectors and IE, in its quirky way, was showing all those tables fine. When I added DOCTYPE to the page, even IE stopped showing them.
so, I need to clean the site up.
any advice?
My advice is to run your HTML and CSS code through the validator as often as possible and always use a doctype! ;)
In this case you need to change the name of your class to male sure that it doesn't start with a numeral. A search and replace across your files for class="1" should do the job. Then change the class in your CSS and things should start working!
HTH
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> The half-doctype shouldn't be used for new documents, but is the best solution here. Once everything's validated and corrected, then you could try switching to a full doctype - but you might not think it's worth it.
After that, I usually use gobal search and replace to make site-wide corrections (as in your example of the class names with numerals). I also introduce PHP includes or at least SSI to simplify future management.
If the markup is really bad, though, sometimes it is quicker to recreate the design using proper standards and rebuild the site from scratch. Obviously, you need to keep the file names the same whatever you do.
I do want to clean the site up to make it cross browser friendly and better to edit in the future and hopefully help on the search engine side of things too.
I already use SSI which should cut down on a lot of search and replace, but not all. It's basically a solid two days of work.
my style sheets are full of things like
font-size:13;
not px, or pt, or em or anything, just 13!
quirks mode will sort that out but it dies a death when I put a doctype onto the page! haha!
busy couple of days ahead....
What I would do is create a new site-wide template using HTML 4.01 Strict and CSS. Once that's done, all that is left is to copy & paste your content from the old design to the new. Since you have so many pages to redo, I would look at getting some help with the copy & paste part. I would also divide the pages in groups depending on how the pages relate to each other and work on each group individually.
do you mean in the olde worlde sense of getting help or using a script of some description?
and, yes, what you said about redesigning the site is pretty much what I had decided needed doing....otherwise, I will be back doing another "clear up" 18 months down the line....better to bite the bullet now and be done with it.