<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: is it possible to set different css on one page depending on browser type?</title>
	<atom:link href="http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/</link>
	<description>Ideas For New Internet Entrepreneurs</description>
	<lastBuildDate>Wed, 15 Jun 2011 09:39:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Archer</title>
		<link>http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/comment-page-1/#comment-1825</link>
		<dc:creator>Archer</dc:creator>
		<pubDate>Tue, 06 Nov 2007 01:54:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/#comment-1825</guid>
		<description>here&#039;s a sample script i made.


full script is in the demo page</description>
		<content:encoded><![CDATA[<p>here&#8217;s a sample script i made.</p>
<p>full script is in the demo page</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: richarduie</title>
		<link>http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/comment-page-1/#comment-1824</link>
		<dc:creator>richarduie</dc:creator>
		<pubDate>Sun, 04 Nov 2007 21:21:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/#comment-1824</guid>
		<description>This is best done on the server,  if you have access to jsp, asp, php, etc., but, if you just have to do it on the client side, I prefer to use the cascade instead of hacks. The idea is to apply a default  style sheet to all pages and then include an overriding set of style for each different browser to be supported. By including alternative styles later in the cascade, they replace the values declared in the default style sheet. Here&#039;s a sample that&#039;s only set to handle Firefox (all), IE6, and IE7.

base.html
~~~~~~~~~









this heading has different color
properties, depending on the browser



Firefox.css
~~~~~~~~~
#differsByBrowser {
color: green;
text-decoration: underline;
}

IE6.css
~~~~~~~~
#differsByBrowser {
color: red;
}

IE7.css
~~~~~~~~~
#differsByBrowser {
color: blue;
}

altStyle.js
~~~~~~~~~
// set style sheet name to denote the
// default browser
var styleName = &#039;Firefox&#039;;

// determine which browser is actually 
// being used and reset the value of 
// styleName, if the preferred, default 
// browser is not the current case
var agt = navigator.userAgent;
// the &quot;sniff&quot; can be as specific as 
// needed, according to the different 
// browsers to be differentially styled
if (-1 != agt.indexOf(&#039;Firefox&#039;)) {
// exit for Firefox - already set
}
if (-1 != agt.indexOf(&#039;MSIE 6&#039;)) {
// reset to indicate IE6
styleName = &#039;IE6&#039;;
}
if (-1 != agt.indexOf(&#039;MSIE 7&#039;)) {
// reset to indicate IE7
styleName = &#039;IE7&#039;;
}
//...handle other browsers as needed...

// if alternate styles are needed for 
// current browser, bring them in here - 
// since they fall later in the cascade, 
// they will override any declared in the 
// default sheet
if (&#039;Firefox&#039; != styleName) {
var s1 = &#039;&#039;;
document.write(s1 + styleName + s2);
}</description>
		<content:encoded><![CDATA[<p>This is best done on the server,  if you have access to jsp, asp, php, etc., but, if you just have to do it on the client side, I prefer to use the cascade instead of hacks. The idea is to apply a default  style sheet to all pages and then include an overriding set of style for each different browser to be supported. By including alternative styles later in the cascade, they replace the values declared in the default style sheet. Here&#8217;s a sample that&#8217;s only set to handle Firefox (all), IE6, and IE7.</p>
<p>base.html<br />
~~~~~~~~~</p>
<p>this heading has different color<br />
properties, depending on the browser</p>
<p>Firefox.css<br />
~~~~~~~~~<br />
#differsByBrowser {<br />
color: green;<br />
text-decoration: underline;<br />
}</p>
<p>IE6.css<br />
~~~~~~~~<br />
#differsByBrowser {<br />
color: red;<br />
}</p>
<p>IE7.css<br />
~~~~~~~~~<br />
#differsByBrowser {<br />
color: blue;<br />
}</p>
<p>altStyle.js<br />
~~~~~~~~~<br />
// set style sheet name to denote the<br />
// default browser<br />
var styleName = &#8216;Firefox&#8217;;</p>
<p>// determine which browser is actually<br />
// being used and reset the value of<br />
// styleName, if the preferred, default<br />
// browser is not the current case<br />
var agt = navigator.userAgent;<br />
// the &#8220;sniff&#8221; can be as specific as<br />
// needed, according to the different<br />
// browsers to be differentially styled<br />
if (-1 != agt.indexOf(&#8216;Firefox&#8217;)) {<br />
// exit for Firefox &#8211; already set<br />
}<br />
if (-1 != agt.indexOf(&#8216;MSIE 6&#8242;)) {<br />
// reset to indicate IE6<br />
styleName = &#8216;IE6&#8242;;<br />
}<br />
if (-1 != agt.indexOf(&#8216;MSIE 7&#8242;)) {<br />
// reset to indicate IE7<br />
styleName = &#8216;IE7&#8242;;<br />
}<br />
//&#8230;handle other browsers as needed&#8230;</p>
<p>// if alternate styles are needed for<br />
// current browser, bring them in here &#8211;<br />
// since they fall later in the cascade,<br />
// they will override any declared in the<br />
// default sheet<br />
if (&#8216;Firefox&#8217; != styleName) {<br />
var s1 = &#8221;;<br />
document.write(s1 + styleName + s2);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brad Wright</title>
		<link>http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/comment-page-1/#comment-1823</link>
		<dc:creator>Brad Wright</dc:creator>
		<pubDate>Sat, 03 Nov 2007 16:10:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/#comment-1823</guid>
		<description>There are multiple hacks you can use:

In all cases .selector denotes that way you&#039;d usually select the elements/classes/IDs:

/* targets all IE */
.selector {
  *property: value;
}

/* targets just IE6 */
* html .selector {
  property: value;
}
/* or */
.selector {
  _property: value;
}

/* to target Safari */
body:last-child:not(:root:root) .selector {
  property: value;
}

/* For Safari 3 and Opera 9 */
@media all and (min-width: 0px) {
  head~body .selector {
    property: value;
  }
}

Or to selectively target entire stylesheets to IE:


The last technique is actually used on the question page here on Answers.</description>
		<content:encoded><![CDATA[<p>There are multiple hacks you can use:</p>
<p>In all cases .selector denotes that way you&#8217;d usually select the elements/classes/IDs:</p>
<p>/* targets all IE */<br />
.selector {<br />
  *property: value;<br />
}</p>
<p>/* targets just IE6 */<br />
* html .selector {<br />
  property: value;<br />
}<br />
/* or */<br />
.selector {<br />
  _property: value;<br />
}</p>
<p>/* to target Safari */<br />
body:last-child:not(:root:root) .selector {<br />
  property: value;<br />
}</p>
<p>/* For Safari 3 and Opera 9 */<br />
@media all and (min-width: 0px) {<br />
  head~body .selector {<br />
    property: value;<br />
  }<br />
}</p>
<p>Or to selectively target entire stylesheets to IE:</p>
<p>The last technique is actually used on the question page here on Answers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: catbertnc</title>
		<link>http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/comment-page-1/#comment-1822</link>
		<dc:creator>catbertnc</dc:creator>
		<pubDate>Wed, 31 Oct 2007 13:33:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/#comment-1822</guid>
		<description>Yes, it can be done. There are many tutorials on the Internet. Here&#039;s one:</description>
		<content:encoded><![CDATA[<p>Yes, it can be done. There are many tutorials on the Internet. Here&#8217;s one:</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepthi</title>
		<link>http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/comment-page-1/#comment-1821</link>
		<dc:creator>Deepthi</dc:creator>
		<pubDate>Tue, 30 Oct 2007 17:25:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmastertechs.com/2007/10/30/is-it-possible-to-set-different-css-on-one-page-depending-on-browser-type/#comment-1821</guid>
		<description>Yeah you can
check type of the browser depending on that you can set the css</description>
		<content:encoded><![CDATA[<p>Yeah you can<br />
check type of the browser depending on that you can set the css</p>
]]></content:encoded>
	</item>
</channel>
</rss>

