<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Geeks Villa &#187; Web browsers</title>
	<atom:link href="http://www.geeksvilla.com/tag/web-browsers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geeksvilla.com</link>
	<description>Latest News, Reviews for Computer Technology</description>
	<lastBuildDate>Fri, 03 Feb 2012 19:40:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>15 Different Techniques and Tools for Cross Browser Compatibility</title>
		<link>http://www.geeksvilla.com/15-different-techniques-and-tools-for-cross-browser-compatibility/</link>
		<comments>http://www.geeksvilla.com/15-different-techniques-and-tools-for-cross-browser-compatibility/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 06:44:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[browser tips]]></category>
		<category><![CDATA[Cross Browser Compatibility]]></category>
		<category><![CDATA[css design]]></category>
		<category><![CDATA[css layout]]></category>
		<category><![CDATA[CSS tips]]></category>
		<category><![CDATA[HTML design]]></category>
		<category><![CDATA[Web browsers]]></category>

		<guid isPermaLink="false">http://www.geeksvilla.com/?p=504</guid>
		<description><![CDATA[Make your websites compatible with a all browsers and I know its very hard job. To make your coding life easier, here are 15+ tools and techniques for cross-browser CSS development. Reset CSS Due to the fact web browsers define different default styling for html elements, the first thing to do is to always include [...]]]></description>
			<content:encoded><![CDATA[<header></header>
<header>Make your websites compatible with a all browsers and I know its very hard job. To make your coding life easier, here are 15+ tools and techniques for <strong>cross-browser CSS development</strong>.</header>
<header><a href="http://www.geeksvilla.com/15-different-techniques-and-tools-for-cross-browser-compatibility/sauce-scout2/" rel="attachment wp-att-505"><img class="size-medium wp-image-505 aligncenter" title="sauce-scout2" src="http://www.geeksvilla.com/wp-content/uploads/sauce-scout2-590x381.png" alt="" width="590" height="381" /></a></header>
<h3></h3>
<h3>Reset CSS</h3>
<p>Due to the fact web browsers define different default styling for html elements, the first thing to do is to always include a CSS reset in your stylesheet. By using this code, you’re already eliminating lots of future headaches.</p>
<blockquote>
<pre>html,body,div,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,p,blockquote,fieldset,input,hr {margin:0; padding:0;}
h1,h2,h3,h4,h5,h6,pre,code,address,caption,cite,code,em,strong,th {font-size:1em; font-weight:normal; font-style:normal;}
ul,ol {list-style:none;}
fieldset,img,hr {border:none;}
caption,th {text-align:left;}
table {border-collapse:collapse; border-spacing:0;}
td {vertical-align:top;}</pre>
</blockquote>
<h3>Internet Explorer conditional comments</h3>
<p>Let’s face it: Internet Explorer, especially the dinosaur IE6, is the front-end developer nightmare. In order to minimize their errors, Microsoft implemented conditional comments in their browser, which allow you to link a style sheet that will be interpreted by a browser alone.</p>
<blockquote>
<pre>&lt;!--[if IE]&gt;
  	&lt;link href="ie.css" rel="stylesheet" type="text/css" /&gt;
&lt;![endif]--&gt;</pre>
</blockquote>
<p>You can also target only a certain version of IE:</p>
<blockquote>
<pre>&lt;!--[if IE6]&gt;
  	&lt;link href="ie.css" rel="stylesheet" type="text/css" /&gt;
&lt;![endif]--&gt;</pre>
</blockquote>
<h3>Internet Explorer hacks</h3>
<p>While conditional comments are better, you can also target some versions of Internet Explorer using the following syntax:</p>
<blockquote>
<pre>.class {
  width:200px; /* All browsers */
  *width:250px; /* IE */
  _width:300px; /* IE6 */
  .width:200px; /* IE7 */
}</pre>
</blockquote>
<p>This technique is not W3C compliant (this is why you should use conditional comments instead) but sometimes, it is a real time saver.</p>
<h3>Targeting Opera only</h3>
<p>Opera isn’t the popular browser, but that isn’t a reason not fix problem that may occur. The code below will only target Opera, allowing you to add CSS rules only for this browser.</p>
<blockquote>
<pre>@media all and (min-width: 0px){
    .classname {}
}</pre>
</blockquote>
<h3>Targeting Safari only</h3>
<p>Safari is one of the most standard-compliant browsers, so it is rare that you have to fix Safari-only problems. But it can happen sometimes. Here is a nice hack to write Safari-only CSS rules.</p>
<blockquote>
<pre>html:lang(en)&gt;body  .classname {}</pre>
</blockquote>
<h3>Targeting Google Chrome only</h3>
<p>After Opera and Safari, here is finally the same kind of hack, to target only Google Chrome:</p>
<blockquote>
<pre>body:nth-of-type(1) p{
   color: #333333;
}</pre>
</blockquote>
<h3>“Browser Detect” PHP Class</h3>
<p>While Internet Explorer is most of the time the reason of cross-browser compatibility problems, sometimes you may need to detect a wide range of browsers</p>
<p>If you’re working with the PHP language, the <a href="http://www.phpclasses.org/browse/package/2827.html" target="blank">Browser Detect</a> class is a very useful tool for detecting more than 20 different browsers.<br />
<a href="http://www.phpclasses.org/browse/package/2827.html" target="blank">Get the class</a></p>
<h3>JQuery browser detection</h3>
<p>Another great piece of code to detect the most common browsers (Safari, Firefox, Chrome, IE and Opera) is the <em>browserdetect.js</em> Jquery plugin.<br />
Once you inclued JQuery and browserdetect.js in your html file, the script will automatically add a css class to the body tag.<br />
For example, your body tag will look like this if the visitor browser is Firefox 3:</p>
<pre>&lt;body&gt;</pre>
<p><a href="http://www.tvidesign.co.uk/blog/CSS-Browser-detection-using-jQuery-instead-of-hacks.aspx" target="blank">Get the code</a></p>
<h3>WordPress browser detection</h3>
<p>A while ago, I’ve explained on my other blog <a href="http://www.wprecipes.com/">WpRecipes</a> how WordPress can detect the browser used by your visitors. The code below will automatically add a CSS class to the <em>&lt;body&gt;</em> element of each page of your blog. Simply paste it on the <em>functions.php</em> file of your theme.</p>
<pre class="brush: php; title: ; notranslate"> add_filter('body_class','browser_body_class');
function browser_body_class($classes) {
	global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;

	if($is_lynx) $classes[] = 'lynx';
	elseif($is_gecko) $classes[] = 'gecko';
	elseif($is_opera) $classes[] = 'opera';
	elseif($is_NS4) $classes[] = 'ns4';
	elseif($is_safari) $classes[] = 'safari';
	elseif($is_chrome) $classes[] = 'chrome';
	elseif($is_IE) $classes[] = 'ie';
	else $classes[] = 'unknown';

	if($is_iphone) $classes[] = 'iphone';
	return $classes;
}  </pre>
<h3>IE6 crash</h3>
<p>Sometimes (Who said always?) Internet fucking Explorer 6 gives us, developers, lots of headaches. Although this is definitely not the best method to make your web clients satisfy. But it can be a fun to fix it.</p>
<p>You have guess it now, the following line of code will make IE6 crash.</p>
<blockquote>
<pre>&lt;style&gt;*{position:relative}&lt;/style&gt;&lt;table&gt;&lt;input&gt;&lt;/table&gt;</pre>
</blockquote>
<p>Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geeksvilla.com/15-different-techniques-and-tools-for-cross-browser-compatibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

