Browser compatibility problems using CSS and DOCTYPE
-
I'm having browser compatibility problems with my website now that I've started using CSS. I want my website to be as browser compatible as possible. Using online web tutorials, I also discovered that my DOCTYPES were written incorrectly. When I corrected them I had a little better luck with browser compatibility. However, using this DOCTYPE: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> my website looks correct in IE 6, Netscape 4 and Netscape 7, but when I view it in IE 5 or Netscape 6, the line spacing is all wrong -- the text becomes almost double spaced. If I try using the strict version of DOCTYPE, then Netscape 7 also starts double spacing. I've searched the web for answers and can't find a single mention of this problem. I even tried using a browser detection script and created 2 versions of my website: a site for IE and a site for Netscape (using DOCTYPES for each browser as needed.) That worked, but it just takes too much time to maintain 2 separate versions of a website. So my question is, why is the line spacing different for only IE5 and Netscape 6? There's got to be a way to have 1 website, using CSS, that has proper text spacing for all the browsers. What am I doing wrong? Here's my website: http://www.hymnchartslite.com/index.htm
-
Answer:
Thanks for asking! You're not doing anything wrong. Except following the rules. :-) As you've already (sadly) discovered, HTML and CSS validation doesn't mean that code will display the same in all browsers. You don't need to maintain separate websites for separate browsers, just separate stylesheets, which is a lot simpler. You'd use the same sort of redirection javascript to detect the browsers, and pull the correct version of the stylesheet to match the user's browser. Once you've decided the size look you prefer, you can define font sizes in pixels for those browser's stylesheets in order to obtain exactly the look you want. This will, of course, prevent some users from scaling the font sizes up or down themselves, which is the primary reason for using the named versions of font sizes. When it comes to true browser compatibility, unfortunately, you can't have it all. You'll either have to settle for browser caused differences, or sacrifice a small degree of usability to achieve the same effect in all browsers. Having played a bit with your stylesheet, substituting font sizes of 13px for small and 10px for x-small offer some improvement. BROWSER DIFFERENCES ********************************************************************** I heartily recommend Webmonkey's article "Sizing Up the Browsers" especially, page three, Text Sizing. You'll find charts that tell you the exact cross-browser differences in text sizing. Webmonkey Tutorials - Sizing Up the Browsers http://hotwired.lycos.com/webmonkey/99/41/index3a_page3.html?tw=design This Google cached version of a WebReview.com page also helps explain many of the cross-browser differences. Common Browser Implementation Issues http://216.239.53.100/search?q=cache:1f9ms-lvLc8C:www.webreview.com/browsers/browser_implementation.shtml MODIFIABLE JAVASCRIPT RESOURCES ********************************************************************** I've located both a javascript generator and a cut and paste javascript that can be modified to work for stylesheet redirection instead of page redirection. If these options are a bit too complex, you can most likely hire a javascript coder to create a custom script at a rather nominal fee, in the range $25-$50|USD. Browser Detection and Redirection Tools - Javascript Generator http://www.webpage-tools.com/browser_redirtool.asp Javascript Source CSS Support Redirection Script http://javascript.internet.com/user-details/css-support-redirect.html ********************************************************************** Google Search Terms browser cross-compatibility "font sizing" IE5 or NS6 "javascript redirection" css OR stylesheets I hope these explanations and resources help you sort out your browser compatibility difficulties. Should you have any questions about the materials or links provided, please, feel free to ask. --larre
donniec-ga at Google Answers Visit the source
Related Q & A:
- How do you search DOM elements using CSS selectors in Chrome?Best solution by Stack Overflow
- How to apply custom css to CKEditor?Best solution by stackoverflow.com
- Why would Arial be placed before Helvetica when using font-family in CSS?Best solution by Quora
- How to save ONLY the CSS changes of Styles panel of Chrome Developer Tools?Best solution by Stack Overflow
- How do update the backwards compatibility on my Xbox 360?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.