<?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>Webgyani &#187; CSS</title>
	<atom:link href="http://webgyani.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://webgyani.com</link>
	<description>A cognitive perspective on web</description>
	<lastBuildDate>Mon, 31 May 2010 16:25:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>CSS border radius madness</title>
		<link>http://webgyani.com/2010/03/css-border-radius-madness/</link>
		<comments>http://webgyani.com/2010/03/css-border-radius-madness/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 14:08:54 +0000</pubDate>
		<dc:creator>Arnab</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://webgyani.com/2010/03/css-border-radius-madness/</guid>
		<description><![CDATA[Border radius is an excellent addition in CSS3, it helps creating some awesome rounded corner boxes super easy. Modern browsers like Firefox, Safari, Chrome, Opera and IE9 all announced or have already implemented support for “border-radius” property in their CSS engine. Firefox and Webkit have the support in the form of vendor prefixed extension, latest Opera follows the W3C standard, it didn’t introduce any vender prefix even though the CSS3 specification is still being actively worked on, by the way the border-radius is now a CR (Candidate Recommendation) as of today. Well, as you might think that I’ll be talking about how to implement border-radius across different browsers, which in fact I don’t intend to do, as there are already a plenty of good examples that you can find if you do some Googling. Recently, I was playing around border-radius in different browsers and I came across some inconsistencies, which [Continue... <span class="meta-nav">&#8594;</span>]]]></description>
			<content:encoded><![CDATA[<p>Border radius is an excellent addition in CSS3, it helps creating some awesome rounded corner boxes super easy. Modern browsers like Firefox, Safari, Chrome, Opera and IE9 all announced or have already implemented support for “<em>border-radius”</em> property in their CSS engine. Firefox and Webkit have the support in the form of vendor prefixed extension, latest Opera follows the W3C standard, it didn’t introduce any vender prefix even though the CSS3 specification is still being actively worked on, by the way the <em><a href="http://www.w3.org/TR/css3-background/" target="_blank">border-radius</a></em> is now a CR (Candidate Recommendation) as of today.</p>
<p>Well, as you might think that I’ll be talking about how to implement <em>border-radius</em> across different browsers, which in fact I don’t intend to do, as there are already a plenty of good examples that you can find if you do some <a href="http://www.google.com/search?q=CSS3+border+radius" target="_blank">Googling</a>. Recently, I was playing around <em>border-radius</em> in different browsers and I came across some inconsistencies, which I want to document it here, I am not sure which implementation is correct in this case but it looks like some browsers have identical implementation while others have a slightly different one. Below is the screenshot of images and how all looks in browsers in different conditions, I’ll show the code and how that works across browsers.</p>
<p>Basic styles for the box that I used in my tests:</p>
<pre>  <code>
  #box {
  margin: 100px;
  width: 250px;
  height: 100px;
  }</code></pre>
<h2>Applying equal border-width and border-radius</h2>
<pre> <code>
/* basic border styling */
  border-width: 20px;
  border-color: red;
  border-style: solid;
  /* Mozilla Firefox */
  -moz-border-radius: 10px;
  /* W3C, Opera and IE9 Preview */
  border-radius: 10px;
  /* Safari and Chrome */
  -webkit-border-radius: 10px;
</code></pre>
<p>After applying the above styles the border on all four browsers look something like below:</p>
<div><img style="display: block; float: none; margin-left: auto; margin-right: auto;" src="http://farm5.static.flickr.com/4068/4479093342_0933062fef_o.png" alt="" /></div>
<p>As you can see in the picture above, the box has given an uniform <em>border-radius</em> and <em>border-width</em> to all borders. It appears that Firefox, Chrome and IE9 all have identical behavior/implementation, only Opera seems to have screwed it up, by the way Opera handles it fine if the <em>border-width</em> value is smaller; in my test I set it up 20px to have the borders more prominent, so that it becomes easier to see the effect.</p>
<h2>Applying variable width and radius to different borders</h2>
<pre> <code>
border-width: 1px 1px 20px 1px;
border-color: red;
border-style: solid;
/* Mozilla Firefox */
-moz-border-radius-bottomleft: 10px;
-moz-border-radius-bottomright: 10px;
/* W3C, Opera and IE9 Preview */
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
/* Safari and Chrome */
-webkit-border-bottom-left-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
</code></pre>
<p>Similarly after applying the above styles the border on all four browsers look really different. I must say that IE9 and Firefox have similar implementation whereas Chrome and Opera is completely different. Here&#8217;s the image:</p>
<div><img style="display: block; float: none; margin-left: auto; margin-right: auto;" src="http://farm3.static.flickr.com/2776/4478467945_4794552360_o.png" alt="" /></div>
<p>Another example this time with right borders:</p>
<pre> <code>
border-width: 1px 20px 1px 1px;
border-color: red;
border-style: solid;
/* Mozilla Firefox */
-moz-border-radius-topright: 10px;
-moz-border-radius-bottomright: 10px;
/* W3C, Opera and IE9 Preview */
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
/* Safari and Chrome */
-webkit-border-top-right-radius: 10px;
-webkit-border-bottom-right-radius: 10px;
</code></pre>
<p>Here is the image:</p>
<div><img style="display: block; float: none; margin-left: auto; margin-right: auto;" src="http://farm5.static.flickr.com/4018/4478467997_7eaf040ded_o.png" alt="" /></div>
<p>As you can see even though all the above mentioned browsers have implemented <em>border-radius</em> property still there are variations in implementations. I am not sure which implementation is technically correct, but Firefox and IE9 seems to have more elegant solution than Chrome and Opera. I would like to hear more from you regarding this, please do comment if you have noticed any other problems with <em>border-radius</em>.</p>
<p>Here&#8217;s the HTML code that I used for my tests <a href="http://gist.github.com/350379" rel="nofollow">http://gist.github.com/350379</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webgyani.com/2010/03/css-border-radius-madness/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to serve different stylesheets only to Safari and Chrome</title>
		<link>http://webgyani.com/2010/03/how-to-serve-different-stylesheets-only-to-safari-and-chrome/</link>
		<comments>http://webgyani.com/2010/03/how-to-serve-different-stylesheets-only-to-safari-and-chrome/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 16:06:00 +0000</pubDate>
		<dc:creator>Arnab</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://webgyani.com/2010/03/how-to-serve-different-stylesheets-only-to-safari-and-chrome/</guid>
		<description><![CDATA[Well, as you already know that to support Internet Explorer we often serve different CSS files using IE’s special conditional-comment syntax, which is great in terms of having clean and maintainable stylesheets throughout your application, it also mitigates the need of writing CSS hacks which often makes the stylesheets messy and becomes a maintenance nightmare later. You may argue that serving different CSS files only to IE  is certainly not an elegant solution and of course it is not, it still requires that extra effort and extra bandwidth for users of Internet Explorer, but it’s somewhat the most practical or possibly the cleanest solution that you can have. As there’s no way to target other browsers using conditional-comment like thing then how would you do it if you ever(though unlikely) have a need to serve different CSS files to some of the modern browsers? Well, seems like I have a [Continue... <span class="meta-nav">&#8594;</span>]]]></description>
			<content:encoded><![CDATA[<p>Well, as you already know that to support <em>Internet Explorer</em> we often serve different CSS files using IE’s special <em>conditional-comment</em> syntax, which is great in terms of having clean and maintainable stylesheets throughout your application, it also mitigates the need of writing CSS hacks which often makes the stylesheets messy and becomes a maintenance nightmare later. You may argue that serving different CSS files only to IE  is certainly not an elegant solution and of course it is not, it still requires that extra effort and extra bandwidth for users of Internet Explorer, but it’s somewhat the most practical or possibly the cleanest solution that you can have.</p>
<p>As there’s no way to target other browsers using <em>conditional-comment</em> like thing then how would you do it if you ever(though unlikely) have a need to serve different CSS files to some of the modern browsers? Well, seems like I have a solution for you. Recently, I stumbled upon a code while doing “view source” (I do it all the times and have found it pretty useful), which had something different that caught my eye on. I don’t know whether this is a well documented or a known thing, but this is something I have never seen before, so I thought it might be a good idea to document it here, in case it helps someone. By the way, keep in mind that this only works in <strong>Safari</strong> and <strong>Chrome</strong> as because both browsers share the same rendering engine, so assuming that all <em>webkit</em> based ones will have the same behavior. <em>Opera,</em> <em>Gecko</em> and <em>Internet Explorer</em> do not exhibit this behavior as I have found.</p>
<p>It appears that <em>webkit</em> ignores “<em>text/css”</em> value of the “<em>type”</em> attribute of &lt;link&gt; tags as long as you have “<em>rel=stylesheet”</em>, I assume that it depends on <em>mime-type</em> instead of the <em>type</em> mentioned in the tag itself. The following code will load the stylesheet file in Safari/Chrome but none of Opera, Gecko(Firefox) and Internet Explorer( 6, 7 and 8 ) will even load the CSS file:</p>
<pre><code>&lt;link rel="stylesheet" href="/style.css" type="text/safari" /&gt;

&lt;link rel="stylesheet" href="/style.css" type="text/chrome" /&gt;</code></pre>
<p>You can have anything in the “<em>type”</em> attribute like “<em>text/mycss” </em>or<em> </em>“<em>text/webkit”</em> all will work. By the way, removing the “<em>type”</em> attribute loads the file in other browser’s too, so to prevent that you got to specify something different albeit an incorrect type. This is a bit whacky or clever way to target <em>webkit</em> specific browsers.</p>
<p>Finally, the question is that do you ever really need this ? I don’t think so, mostly 99% cases you don’t need to target <em>webkit</em> browsers specifically, they have an excellent support of web standards and my experience says that most of the things just work out of the box in <em>webkit </em>and<em> gecko</em>. So this tip is for that 1% edge cases where you might need this.</p>
<p>I tested the above code in Firefox 3.6, Safari 4, Chrome 4, Opera 10.50 Beta and Internet Explorer(6, 7 and 8).</p>
]]></content:encoded>
			<wfw:commentRss>http://webgyani.com/2010/03/how-to-serve-different-stylesheets-only-to-safari-and-chrome/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The Mystery Of CSS Sprites: Techniques, Tools And Tutorials &#124; CSS &#124; Smashing Magazine</title>
		<link>http://webgyani.com/2009/04/the-mystery-of-css-sprites-techniques-tools-and-tutorials-css-smashing-magazine/</link>
		<comments>http://webgyani.com/2009/04/the-mystery-of-css-sprites-techniques-tools-and-tutorials-css-smashing-magazine/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 07:27:18 +0000</pubDate>
		<dc:creator>Arnab</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Sprites]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://webgyani.wordpress.com/?p=29</guid>
		<description><![CDATA[The Mystery Of CSS Sprites: Techniques, Tools And Tutorials &#124; CSS &#124; Smashing Magazine. CSS Sprites are not new. In fact, they are a rather well-established technique and have managed to become common practice in Web development. Of course, CSS sprites are not always necessary, but in some situation they can bring significant advantages and improvements — particularly if you want to reduce your server load. And if you haven’t heard of CSS sprites before, now is probably a good time to learn what they are, how they work and what tools can help you create and use the infamous technique in your projects. Read the full article at Smashing Magazine, it contains a ton of links regarding CSS-Sprites, check them out, after that you should have a fair understanding of what it is, and you will be able to optimize your site, which will load faster and also saves [Continue... <span class="meta-nav">&#8594;</span>]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.smashingmagazine.com/2009/04/27/the-mystery-of-css-sprites-techniques-tools-and-tutorials/">The Mystery Of CSS Sprites: Techniques, Tools And Tutorials | CSS | Smashing Magazine</a>.</p>
<blockquote><p><strong>CSS Sprites</strong> are not new. In fact, they are a rather well-established technique and have managed to become common practice in Web development. Of course, CSS sprites are not always necessary, but in some situation they can bring significant advantages and improvements — particularly if you want to reduce your server load. And if you haven’t heard of CSS sprites before, now is probably a good time to learn what they are, how they work and what tools can help you create and use the infamous technique in your projects.</p></blockquote>
<p>Read the full article at Smashing Magazine, it contains a ton of links regarding CSS-Sprites, check them out, after that you should have a fair understanding of what it is, and you will be able to optimize your site, which will load faster and also saves a lot of bandwidth, by the way this will also give users a nice experience. Keep reading&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://webgyani.com/2009/04/the-mystery-of-css-sprites-techniques-tools-and-tutorials-css-smashing-magazine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE textarea background image problem</title>
		<link>http://webgyani.com/2009/03/ie-textarea-background-image-problem/</link>
		<comments>http://webgyani.com/2009/03/ie-textarea-background-image-problem/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 06:49:19 +0000</pubDate>
		<dc:creator>Arnab</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[background image]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Textarea]]></category>
		<category><![CDATA[Textbox]]></category>

		<guid isPermaLink="false">http://webgyani.wordpress.com/?p=10</guid>
		<description><![CDATA[Internet Explorer has a problem in setting background image to textarea, the scrolling mechanism as implemented by the browser is buggy while all other browsers handle it properly, IE fails naturally . The problem is if you set a background image to textarea and when you scroll the textarea the background image also scrolls, this behavior is incorrect because as far as I can recall an element background should only scroll with regards to the viewport. The easiest way to reproduce this bug is to use a vertical &#8220;sprite&#8221; image as the textarea background and set background-repeat to &#8220;no-repeat&#8220;, background-attachment to &#8220;scroll&#8220;, also apply position values to display part of image and try to enter multiline text in the box you can see the bug in IE. The only fix is that to set the background-attachment value to &#8220;fixed&#8221; which eventually solves the problem. This problem may be present in [Continue... <span class="meta-nav">&#8594;</span>]]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer has a problem in setting background image to textarea, the scrolling mechanism as implemented by the browser is buggy while all other browsers handle it properly, IE fails naturally <img src='http://webgyani.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . The problem is if you set a background image to textarea and when you scroll the textarea the background image also scrolls, this behavior is incorrect because as far as I can recall an element background should only scroll with regards to the viewport. The easiest way to reproduce this bug is to use a vertical &#8220;sprite&#8221; image as the textarea background and set <em>background-repeat</em> to &#8220;<em>no-repeat</em>&#8220;, <em>background-attachment</em> to &#8220;<em>scroll</em>&#8220;, also apply position values to display part of image and try to enter multiline text in the box you can see the bug in IE. The only fix is that to set the <em>background-attachmen</em>t value to &#8220;<em>fixed</em>&#8221; which eventually solves the problem. This problem may be present in input boxes also in IE although not verified.</p>
<blockquote><p>Note: But if the textarea is inside a container which itself has <em>position</em> &#8220;<em>fixed</em>&#8221; and textarea <em>background-attachment</em> has also set to &#8220;<em>fixed</em>&#8221; then you will not see any background image, the reason for this may be that IE is trying to set the background image according to viewport because of the <em>background-attachment</em> value. I encoutnered this problem few times but so far have not found any solution.</p></blockquote>
<p><strong>Further reading:</strong></p>
<p><a href="http://www.w3.org/TR/CSS21/colors.html#propdef-background-attachment" target="_blank">http://www.w3.org/TR/CSS21/colors.html#propdef-background-attachment</a></p>
<blockquote><p>Note that there is only one viewport per view. If an element has a scrolling mechanism (see &#8216;overflow&#8217;), a &#8216;fixed&#8217; background doesn&#8217;t move with the element, and a &#8216;scroll&#8217; background doesn&#8217;t move with the scrolling mechanism.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://webgyani.com/2009/03/ie-textarea-background-image-problem/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
