{"id":1502,"date":"2018-01-19T19:22:55","date_gmt":"2018-01-19T19:22:55","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/browser-detection-and-appropriate-css-generation\/"},"modified":"2018-01-19T19:24:50","modified_gmt":"2018-01-19T19:24:50","slug":"browser-detection-and-appropriate-css-generation","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/browser-detection-and-appropriate-css-generation\/","title":{"rendered":"Browser Detection and Appropriate CSS Generation"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By Tim Perdue<\/div>\n<div class=\"\">on August 20, 2000<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/tim2.jpg\" class=\"articleAuthorImg\" alt=\"picture of Tim Perdue\" height=\"90\" width=\"100\" align=\"left\"\/><\/p>\n<div class=\"articlePara\">\nWhoever said CSS would solve all your cross-platform browser display issues needs<br \/>\nto lay off the pipe a little. I have yet to get CSS to work perfectly across all browsers \/<br \/>\nplatforms, but I have gotten it to work &#8220;good enough&#8221; to get by.<\/div>\n<div class=\"articlePara\">\nI did it by using some fairly simplistic browser detection, as in recycling a library I<br \/>\nwrote for SourceForge (which was recycled from a library on GotoCity.com).<\/div>\n<div class=\"articlePara\">\nHere are some of the things I discovered while setting up CSS on a handful of sites:<\/div>\n<div class=\"articleList\">\n<ol>\n<li>If you don&#8217;t set a font at all, users will complain because their browser<br \/>\ndefaults are either too big or too small &#8211; as if it&#8217;s your fault.<\/li>\n<li>Using the CSS1 <b>font-size:<\/b> tag with a specific point size like <b>12pt<\/b> breaks<br \/>\nsome browsers on some platforms (Netscape on Wintel).<\/li>\n<li>Even if that weren&#8217;t the case, point sizes are different on different platforms<br \/>\n(Macs display fonts smaller than Windows).<\/li>\n<li>And even if they rendered the same across all platforms, it&#8217;s a really bad idea<br \/>\nto hard-code sizes, as there are many people with impaired vision. When you hard-code<br \/>\na point-size, they can&#8217;t override the size with their browser, and thus can&#8217;t see your site.<br \/>\nOne of the worst sites on the internet is CNN.com, which hard-codes very small fonts into<br \/>\ntheir CSS sheet.<\/li>\n<li>Because of this, you should stick with scaling percentages or the size syntax<br \/>\n(small, medium, x-small, etc).<\/li>\n<\/ol>\n<\/div>\n<div class=\"articlePara\">\nWith those hard-learned lessons in mind, you can design a browser-smart CSS sheet and<br \/>\ngenerate it with PHP. I won&#8217;t go into details on CSS here. You can view the spec and<br \/>\nexamples at <a href=\"http:\/\/www.w3.org\/Style\/CSS\/Test\/19981002\/\" target=\"_blank\"><br \/>\nhttp:\/\/www.w3.org\/Style\/CSS\/Test\/19981002\/<\/a>.<\/div>\n<div class=\"articlePara\">\nMost of that spec was completely ignored by the geniuses at Netscape and Microsoft, which<br \/>\nis why it has become such a headache for developers.<\/div>\n<\/div>\n<p><\/p>\n<div style=\"float: left; padding:15px; color:#17AAF3\">\n<div style=\"background-color:#B6E5FC; font-size:16px; margin-top:1px; padding:1px 4px 1px 4px; color:#000; font-style:bold; float:left;\">1<\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"tim200008214658.html?page=2\">2<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"tim200008219ba9.html?page=3\">3<\/a> <\/div>\n<div style=\"float:left; font-size:16px; color:#FF7A22; padding:2px 2px 2px 2px; \">| <\/div>\n<div style=\"float:left; padding:2px 4px 2px 4px;\"><a class=\"pageNumber\" href=\"tim20000821fdb0.html?page=4\">4<\/a> <\/div>\n<div style=\"float:left; padding:2px;\"><a class=\"paginationPageLink\" href=\"tim200008214658.html?page=2\">Next Page \u00bb<\/a><\/div>\n<\/div>\n<p> Download: <a href=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/tim20000821.zip\">tim20000821.zip<\/a>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>By Tim Perdue on August 20, 2000 Whoever said CSS would solve all your cross-platform browser display issues needs to lay off the pipe a little. I have yet to get CSS to work perfectly across all browsers \/ platforms, but I have gotten it to work &#8220;good enough&#8221; to&#8230; <a href=\"https:\/\/phpbuilder.com\/browser-detection-and-appropriate-css-generation\/\" class=\"readmore\"><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1502","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1502"}],"version-history":[{"count":2,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1502\/revisions"}],"predecessor-version":[{"id":2409,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1502\/revisions\/2409"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}