Websites being converted to Standards mode and my struggles with it.

Well, (why I do I start everything I start talking about with “Well”.. well, I don’t know) I decided this week to try and convert the www.pelicar.info site from using frames for its presentation to DIV containers and CSS to achieve the same thing as best I could. In the end, I think I have achieved this. The website still has a left-hand menu that stays in place while scrolling the main contents. Also, the address bar will actually show the proper URL for the page and if you do a browser refresh, the current page will display again and not go back to the home page. Before, to refresh the main content, you had right-click within that frame and then choose refresh. Most folks are not accustomed to doing that, however. This also makes bookmarking a specific page much easier and is a bit more compatible with search engines.

Luckily, no-one is using older browsers such as IE5 or at least very few. When they scroll on the page the menu will go up along with everything else. Another thing that changes are some layout/rendering differences. The reason.. it has to do with the difference between Quirks and Standards mode. In fact, depending on the DOCTYPE of the page, IE6 and 7 can be made to function in Quirks mode or Standards mode. Following are a couple resources that explain the differences:

Quirks Mode vs Standards Mode – overview
The Box Models – Standard vs Quirks

So, in Quirks mode the border and padding are inside the Width you give an element which means you are giving it the width that everything should take up, while in Standards mode the border and padding are outside the Width you give to an element. Here you are specifying the width of the content only.

This difference in the box model caused some issues dealing with paragraphs that contain italicized text. I kept noticing some pages had a horizontal scroll bar at the bottom of the page for apparently no reason that would only scroll for a couple pixels… nothing was extending past the right edge. I was going nuts loco. I also noticed that as I narrowed the browser window where a paragraph contained some italics and was flowing around a picture, the picture would sometimes jump below the paragraph! (Here’s that page) Googling around, I stumbled upon this article: IE and Italics. I had to add a style to combat it:

/* Doing overflow:hidden to correct IE and italics rendering issues */
P {
  overflow: hidden;
}

There might be a better way as this does cause it to chop the text off.. but it stopped the weird behavior for now. Changing the padding on my divs might solve it but I was tired of messing with it after that worked.

Another thing I changed was to use relative font sizing instead of fixed point or pt sizing. Well, this opened up another can of worms I wasn’t expecting. There was a page that contained several table (the New Creatures page) and I had defined the TD element with this style:

TD, TH { font-family: Arial; font-size: 0.80em; }

Which makes the font 80% smaller than the main body font which is 1.0em (by the way em refers to the size that a capitol letter “M” takes up). But, the text in one table looked much smaller than it should. Well, as it turns out, that table had a table within a table on the left, and the right had text explaining the items in the table. The text everywhere was too small. Turned out to be a problem of inheritance. This page explains it: Relative font sizes and inheritance. Since the font of the first TD was reduced by 80%, that is now considered the base font size for everything in that element. The nested table caused its text to be further reduced another 20%. I fixed the problem with the nested table by doing the following:

TD, TH { font-family: Arial; font-size: 0.80em; }
TD TD, TD TH { font-size: 1.0em; }

This keeps the nested TD element with the same base TD size of 0.80em instead of reducing it again. To fix the normal text that I did not want to be reduced in size by the initial 80% I made its TD element like this:

<td STYLE="font-family: Times New Roman; font-size:1.0em;">

Problems solved! 😀

I am also in the middle of changing my main website to run in Standards mode as well and cleaning up some of the 15 year old coding in some places… like closing paragraph tags and other things LOL. I don’t know if I can keep it looking the same if I get rid of the frames, namely due to the embedded media player in the bottom-left frame. Just don’t think there’s a way without frames to keep a song playing around while browsing, unless the player is loaded in a separate pop-up or browser window which I don’t really like. Hmmmm.. Anyway, all for now I guess.

1 thought on “Websites being converted to Standards mode and my struggles with it.