<?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>Vacheslav Starikov&#039;s &#187; css</title>
	<atom:link href="http://starikovs.com/cat/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://starikovs.com</link>
	<description>BLOG</description>
	<lastBuildDate>Wed, 21 Dec 2011 19:37:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Absolute elements ignore z-index in IE6 and IE7</title>
		<link>http://starikovs.com/2011/04/13/absolute-elements-ignore-z-index-in-ie6-and-ie7/</link>
		<comments>http://starikovs.com/2011/04/13/absolute-elements-ignore-z-index-in-ie6-and-ie7/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 08:19:04 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[ie7]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=509</guid>
		<description><![CDATA[In this article I will show an example of how to fix the IE 6-7 bug when absolute elements ignore z-index CSS property. In the screenshot above you can see the problem. In the sample below you can see how these styles work in your browser: 1 2 HTML: &#60;div id=&#34;column1&#34;&#62;1&#60;div id=&#34;absoluteDiv&#34;&#62;&#60;/div&#62;&#60;/div&#62; &#60;div id=&#34;column2&#34;&#62;2&#60;/div&#62; CSS: [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://starikovs.com/wp-content/uploads/2011/04/absolute_element_ignores_zindex.png" alt="" title="absolute_element_ignores_zindex" width="493" height="74" class="alignnone size-full wp-image-510" /></p>
<p>In this article I will show an example of how to fix the IE 6-7 bug when absolute elements ignore <code>z-index</code> CSS property. In the screenshot above you can see the problem.  In the sample below you can see how these styles work in your browser: </p>
<div style="display: block; position: relative; float: left; width: 100px; margin: 5px; padding: 5px; border: 1px solid red;">1
<div style="display: block; position: absolute; top: 5px; left: 20px; width: 200px; height: 30px; background-color: yellow; border: 1px solid orange; z-index: 10000;"></div>
</div>
<div style="display: block; position: relative; float: left; width: 100px; margin: 5px; padding: 5px; border: 1px solid red;">2</div>
<div style="clear: both; float: none;"></div>
<p><strong>HTML</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;column1&quot;</span>&gt;</span>1<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;absoluteDiv&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;column2&quot;</span>&gt;</span>2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p><strong>CSS</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#column1</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#column2</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#absoluteDiv</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> orange<span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">10000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>To fix the bug you need to add <code>z-index</code> property to all the parents of your absolute element until you reach the siblings that overlap your absolute element. So, here&#8217;s a workaround:</p>
<p><strong>FIX</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#column1</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">10000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/04/13/absolute-elements-ignore-z-index-in-ie6-and-ie7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting cellspacing and cellpadding in CSS</title>
		<link>http://starikovs.com/2011/04/01/cellspacing-and-cellpadding-in-css/</link>
		<comments>http://starikovs.com/2011/04/01/cellspacing-and-cellpadding-in-css/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 10:07:12 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=489</guid>
		<description><![CDATA[In this article you can find an example of how to set the cellspacing and cellpadding values with help of CSS styles. First let&#8217;s declare a table with cellspacing and cellpadding attributes and see how it looks: &#60;table cellpadding=&#34;3&#34; cellspacing=&#34;3&#34; border=&#34;1&#34;&#62; &#60;tr&#62; &#60;td&#62;1&#60;/td&#62; &#60;td&#62;2&#60;/td&#62; &#60;/tr&#62; &#60;tr&#62; &#60;td&#62;3&#60;/td&#62; &#60;td&#62;4&#60;/td&#62; &#60;/tr&#62; &#60;/table&#62; In your browser this table [...]]]></description>
			<content:encoded><![CDATA[<p>In this article you can find an example of how to set the cellspacing and cellpadding values with help of CSS styles.</p>
<p>First let&#8217;s declare a table with cellspacing and cellpadding attributes and see how it looks:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">table</span> <span style="color: #000066;">cellpadding</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">cellspacing</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">border</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span>4<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">table</span>&gt;</span></pre></div></div>

<p>In your browser this table has the following presentation:</p>
<table cellpadding="3" cellspacing="3" border="1" style="border-collapse: separate;">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>
<p>Now, let&#8217;s override the values of cellspacing and cellpadding attributes with help of CSS style:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">table <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">separate</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
table td<span style="color: #00AA00;">,</span> table th <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>If we apply these styles to our table the cellspacing and cellpadding values of the table will be changed:</p>
<table cellpadding="3" cellspacing="3" border="1" style="border-collapse: separate; border-spacing: 10px;">
<tr>
<td style="padding: 10px;">1</td>
<td style="padding: 10px;">2</td>
</tr>
<tr>
<td style="padding: 10px;">3</td>
<td style="padding: 10px;">4</td>
</tr>
</table>
<p>These styles work in all the mordern browsers. If you want these attributes get working in <strong>IE 6</strong> and <strong>IE 7</strong> you still should use HTML attributes. By the way, cellpadding and cellspacing HTML attributes ARE NOT deprecated so you can fearlessly use them.</p>
<h3>What if cellspacing is zero?</h3>
<p>If you need to set cellspacing to zero with help of CSS you should use these styles:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">table <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">border-collapse</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">collapse</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
table td<span style="color: #00AA00;">,</span> table th <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>So, applying these styles to the table above we will get:</p>
<table cellpadding="3" cellspacing="3" border="1" style="border-collapse: collapse;">
<tr>
<td style="padding: 10px;">1</td>
<td style="padding: 10px;">2</td>
</tr>
<tr>
<td style="padding: 10px;">3</td>
<td style="padding: 10px;">4</td>
</tr>
</table>
<p>These styles work OK in <strong>IE6+</strong>.</p>
<h3>Browsers</h3>
<p>I&#8217;ve just tested this example in different browsers:</p>
<table>
<tr>
<th>FireFox 4</th>
<td>OK</td>
</tr>
<tr>
<th>Google Chrome</th>
<td>OK</td>
</tr>
<tr>
<th>Safari 5</th>
<td>OK</td>
</tr>
<tr>
<th>Opera 11</th>
<td>OK</td>
</tr>
<tr>
<th>Internet Explorer 8</th>
<td>OK</td>
</tr>
<tr>
<th>Internet Explorer 7</th>
<td>INCOMPLETELY</td>
</tr>
<tr>
<th>Internet Explorer 6</th>
<td>INCOMPLETELY</td>
</tr>
</table>
<h3>Need help on CSS properties? Check these links <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h3>
<p><a href="http://www.w3schools.com/Css/pr_tab_border-collapse.asp">border-collapse</a></p>
<p><a href="http://www.w3schools.com/css/pr_tab_border-spacing.asp">border-spacing</a></p>
<p><a href="http://www.w3schools.com/css/css_padding.asp">padding</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/04/01/cellspacing-and-cellpadding-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making content unselectable with help of CSS</title>
		<link>http://starikovs.com/2011/01/29/css-unselectable/</link>
		<comments>http://starikovs.com/2011/01/29/css-unselectable/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 09:53:52 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=420</guid>
		<description><![CDATA[Sometimes, I need to make unselectable the content of a html page for some time while some operations are performed, for example, drag and drop. Unfortunally, not all the browsers support the styles to make the content unselectable. For these browsers, you might create a layer (DIV) to disable selecting. This layer should be positioned [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, I need to make unselectable the content of a html page for some time while some operations are performed, for example, drag and drop. Unfortunally, not all the browsers support the styles to make the content unselectable. For these browsers, you might create a layer (DIV) to disable selecting. This layer should be positioned absolutely and should have the viewport size. The other way to implement the unselectable behaviour is to create special event handlers with help of javascript. For example, in Internet Explorer, you can use javascript to set a handler for an event <code>onselectstart</code> to cancel the action.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">element.<span style="color: #660066;">onselectstart</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<h4>CSS styles:</h4>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.unselectable</span> <span style="color: #00AA00;">&#123;</span>
    -webkit-user-select<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Safari, Chrome */</span>
    -khtml-user-select<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Konqueror */</span>
    -moz-user-select<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Firefox */</span>
    user-select<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* CSS3 */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Hope in the nearest future, we will use only CSS3 property for this need <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Example of use:</h4>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">#<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#testdiv&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;mousedown&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;unselectable&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ...					
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
#<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;mousemove&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #009966; font-style: italic;">/* some code */</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
#<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#testdiv&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;mouseup&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;unselectable&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ...					
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2011/01/29/css-unselectable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IE7 ignores margin-top following an element with absolute position</title>
		<link>http://starikovs.com/2010/12/24/ie7-margin-top-and-absolute-pos-element/</link>
		<comments>http://starikovs.com/2010/12/24/ie7-margin-top-and-absolute-pos-element/#comments</comments>
		<pubDate>Fri, 24 Dec 2010 11:33:14 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[ie7]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=411</guid>
		<description><![CDATA[Hi everybody! Today I will share some workaround depending with margin-top bug in IE 7. I&#8217;ve just created a container DIV that has two child elements. The first child element has an absolute position and the second one has a relative position. Also, the second child element has top margin but this margin is ignored [...]]]></description>
			<content:encoded><![CDATA[<p>Hi everybody! Today I will share some workaround depending with margin-top bug in IE 7. I&#8217;ve just created a container DIV that has two child elements. The first child element has an absolute position and the second one has a relative position. Also, the second child element has top margin but this margin is ignored by IE7. The top margin for the relative positioned element is ignored because the previous sibling is an element with an absolute position.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;absolute-element&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;relative-element&quot;</span>&gt;</span>some content<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#absolute-element</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">100px</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#relative-element</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100%</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">margin-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* THIS MARGIN IS IGNORED! */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>Workaround</h3>
<p>My css hack is in adding a auxiliary DIV that clears floats etc. It helps!</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;container&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;absolute-element&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;help&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;relative-element&quot;</span>&gt;</span>some content<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#help</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> 
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/12/24/ie7-margin-top-and-absolute-pos-element/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>ContentEditable outline style in WebKit</title>
		<link>http://starikovs.com/2010/09/18/contenteditable-outline-style-webkit/</link>
		<comments>http://starikovs.com/2010/09/18/contenteditable-outline-style-webkit/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 10:32:16 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[chrome]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=326</guid>
		<description><![CDATA[As you know, when you make an editable node by setting an appropriate attribute, WebKit selects an editable area using outline. This outline is a border that surrounds the editable content. The editable area is selected only when you set focus on it, in other words, when contentEditable attribute has been set to true. To [...]]]></description>
			<content:encoded><![CDATA[<p>As you know, when you make an editable node by setting an appropriate attribute, WebKit selects an editable area using outline. This outline is a border that surrounds the editable content. The editable area is selected only when you set focus on it, in other words, when <code>contentEditable</code> attribute has been set to <code>true</code>. To change styles of this outline we have to use CSS rules. There are limited amount of styles that can be changed for the outline of the editable area. They are:</p>
<ul>
<li>Color (the same as border color)</li>
<li>Width (the same as border width)</li>
<li>Style (the same as border style)</li>
</ul>
<p>Ok, let&#8217;s test!</p>
<p><span id="more-326"></span></p>
<h3>Let&#8217;s see at the default style</h3>
<p><img src="http://starikovs.com/wp-content/uploads/2010/09/contentEditable1.png" alt="contentEditable1" title="contentEditable1" width="501" height="71" class="aligncenter size-full wp-image-351" /><br />
<!--img src="/wp-content/uploads/contentEditable1.png" alt="Content editable node in WebKit" /--></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> contentEditable<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Lorem ipsum...<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<h3>Changing all the styles</h3>
<p><img src="http://starikovs.com/wp-content/uploads/2010/09/contentEditable2.png" alt="contentEditable2" title="contentEditable2" width="503" height="74" class="aligncenter size-full wp-image-353" /><br />
<!--img src="/wp-content/uploads/contentEditable2.png" alt="Content editable node in WebKit" /--></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">  <span style="color: #00AA00;">&#91;</span>contentEditable<span style="color: #00AA00;">=</span>true<span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:focus </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">dashed</span> <span style="color: #cc00cc;">#7B68EE</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>As you see above, when you change all the styles the rounded corners of the outline are disappeared. More precisely, when you change an outline border style the outline curved corners are disappeared. To save the rounded corners you should change only a color or a size. In the example below, the curved corners are preserved.</p>
<h3>Changing only color</h3>
<p><img src="http://starikovs.com/wp-content/uploads/2010/09/contentEditable3.png" alt="contentEditable3" title="contentEditable3" width="501" height="70" class="aligncenter size-full wp-image-354" /><br />
<!--img src="/wp-content/uploads/contentEditable3.png" alt="Content editable node in WebKit" /--></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">  <span style="color: #00AA00;">&#91;</span>contentEditable<span style="color: #00AA00;">=</span>true<span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:focus </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">outline-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#7B68EE</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>There&#8217;s another limitation of the styles, you cannot set the custom radius for the outline rounded corners <img src='http://starikovs.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<h3>Browsers</h3>
<p>WebKit is an engine that is used by some popular browsers like Chrome, Safari etc. So, you can use the styles shown above in the browsers that use WebKit engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/09/18/contenteditable-outline-style-webkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using CSS3 rounded corners in practice</title>
		<link>http://starikovs.com/2010/08/24/css3-rounded-corners/</link>
		<comments>http://starikovs.com/2010/08/24/css3-rounded-corners/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 08:44:38 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=224</guid>
		<description><![CDATA[In this article, I am going to test CSS 3 rounded corners. I do want to know can I use them in practice in different browsers. Here are some examples of CSS3 rounded corners and if you can see some rounded corners &#8211; congratulations your browser supports them! border-radius: 20px border-top-right-radius: 20px border-bottom-right-radius: 20px border-bottom-left-radius: [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css">
	div.css3-rounded-corners {
		width: 100px;
		height: 50px;
		border: 2px solid #000;
		background-color: #fff;
	}
	#border-radius {
		border-color: red;
		border-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 20px; /* Linux browsers */
		behavior: url(/my-examples/files/border-radius.htc); /* maybe ALL IE */
	}
	#border-top-right-radius {
		border-color: green;
		border-top-right-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-top-right-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-topright: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-top-right-radius: 20px; /* Linux browsers */
	}
	#border-bottom-right-radius {
		border-color: blue;
		border-bottom-right-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-bottom-right-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-bottomright: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-bottom-right-radius: 20px; /* Linux browsers */
	}
	#border-bottom-left-radius {
		border-color: orange;
		border-bottom-left-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-bottom-left-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-bottomleft: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-bottom-left-radius: 20px; /* Linux browsers */
	}
	#border-top-left-radius {
		border-color: pink;
		border-top-left-radius: 20px; /* CSS3 declaration */</p>
<p>		-webkit-border-top-left-radius: 20px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius-topleft: 20px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-top-left-radius: 20px; /* Linux browsers */
	}
	#border-complex1-radius {
		border-color: Gold;</p>
<p>		border-radius: 30px 0 30px 0; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 30px 0 30px 0; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 30px 0 30px 0; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 30px 0 30px 0; /* Linux browsers */
	}
	#border-complex2-radius {
		border-color: OrangeRed;</p>
<p>		border-radius: 10px 30px 10px 30px ; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 10px 30px 10px 30px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 10px 30px 10px 30px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 10px 30px 10px 30px; /* Linux browsers */
	}
	#border-complex3-radius {
		border-color: violet;</p>
<p>		border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* CSS3 declaration */</p>
<p>		-webkit-border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* declaration for WebKit browsers like: Safari, Chrome */
		-moz-border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* declaration for Mozilla browsers like FireFox */
		-khtml-border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px; /* Linux browsers */
	}
        table.css3-rounded-corners-table td { border: 0; padding: 7px; vertical-align: middle; }
</style>
<p>In this article, I am going to test CSS 3 rounded corners. I do want to know can I use them in practice in different browsers. Here are some examples of CSS3 rounded corners and if you can see some rounded corners &#8211; congratulations your browser supports them!</p>
<table border="0" class="css3-rounded-corners-table">
<tr>
<td>
<div id="border-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-top-right-radius" class="css3-rounded-corners"></div>
</td>
<td>border-top-right-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-bottom-right-radius" class="css3-rounded-corners"></div>
</td>
<td>border-bottom-right-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-bottom-left-radius" class="css3-rounded-corners"></div>
</td>
<td>border-bottom-left-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-top-left-radius" class="css3-rounded-corners"></div>
</td>
<td>border-top-left-radius: 20px</td>
</tr>
<tr>
<td>
<div id="border-complex1-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 30px 0 30px 0</td>
</tr>
<tr>
<td>
<div id="border-complex2-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 10px 30px 10px 30px</td>
</tr>
<tr>
<td>
<div id="border-complex3-radius" class="css3-rounded-corners"></div>
</td>
<td>border-radius: 20px 20px 5px 5px / 40px 40px 5px 5px</td>
</tr>
</table>
<p><span id="more-224"></span></p>
<h3>Browsers</h3>
<p>Before CSS3 appeared, web developers had to use some combinations of DIV’s or other container elements with curved corner images to achieve the desired result. Today, when CSS3 is supported by almost all the popular browsers the approach to make rounded corners is very easier, shorter and faster.</p>
<p>The only one little problem has place, is the compatibility with IE.</p>
<p>Here’s the table of browsers I tested on:</p>
<table>
<tr>
<th>Browser</th>
<th>Supports rounded corners</th>
</tr>
<tr>
<td>FireFox 3.6</td>
<td>Yes</td>
</tr>
<tr>
<td>Safari 5</td>
<td>Yes</td>
</tr>
<tr>
<td>Opera 10</td>
<td>Yes</td>
</tr>
<tr>
<td>Chrome</td>
<td>Yes</td>
</tr>
<tr>
<td>IE 6+</td>
<td>Limited and only with hacks</td>
</tr>
<tr>
<td>IE 9</td>
<td>Microsoft pomised</td>
</tr>
</table>
<h3>IE workaround</h3>
<h5>border-radius.htc</h5>
<p>To make curved corners in IE the behavior htc file should be used. You can download the file from here <a href="http://code.google.com/p/curved-corner/">http://code.google.com/p/curved-corner/</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
...
behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border-radius.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>There&#8217;re some limitations, for example, this behaviour htc file can round only all the corners of the container, but it cannot round only one, two or three specific corners. So, the CSS3 allows to round only right corner, for example, but the behavior htc file doesn’t. Other issues you can find at the page of this htc file.</p>
<h5>PIE library</h5>
<p>Another usefull library is <a href="http://css3pie.com">PIE</a>. With PIE you can round corners and reach other CSS3 features to work. Let&#8217;s see an example that is using PIE:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
...
behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">PIE.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<h3>CSS rules for all browsers</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
<span style="color: #808080; font-style: italic;">/* declaration for WebKit browsers like: Safari, Chrome */</span>
-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
<span style="color: #808080; font-style: italic;">/* declaration for Mozilla browsers like FireFox */</span>
-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
 <span style="color: #808080; font-style: italic;">/* Linux browsers */</span>
-khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
 <span style="color: #808080; font-style: italic;">/* maybe ALL IE */</span>
behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border-radius.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<h3>Understanding syntax</h3>
<p>The curved corner is a quarter of the ellipse that defines the shape of the corner. To understand that see the image from the W3C:</p>
<p><img src="http://www.w3.org/TR/2002/WD-css3-border-20021107/corner.png" alt="Ellipse that defines the shape of the corners." /></p>
<p>So, to define the rounded corner the horizontal and vertical radii should be set, but the vertical radius parameter is optional. If you define only one parameter it will be applied to the horizontal and vertical radii.</p>
<p>Now, let’s see the syntax:</p>
<p><strong>border-radius:</strong> <span style="color:#D2691E">[&lt;length&gt; | &lt;percentage&gt;]{1,4}</span><span style="color:#228B22"> [ / [&lt;length&gt; | &lt;percentage&gt;]{1,4} ]?</span></p>
<p><span style="color:#D2691E">The first parameter defines the horizontal radius and if the second parameter is missed the vertical radius.</span></p>
<p><span style="color:#228B22">The second parameter defines the vertical radius of the ellipse that defines the shape of the corner.</span></p>
<p>The ‘border-radius’ sets values for all the four corners.</p>
<p><strong>Examples:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* all the corners have an equal curved corner */</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> 
&nbsp;
 <span style="color: #808080; font-style: italic;">/* works as in the picture above */</span>
border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">55pt</span> / <span style="color: #933;">25pt</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>border-top-right-radius, <br />border-bottom-right-radius, <br />border-bottom-left-radius, <br />border-top-left-radius: </strong><span style="color:#D2691E">[&lt;length&gt; | &lt;percentage&gt;]</span><span style="color:#228B22"> [&lt;length&gt; | &lt;percentage&gt;]?</span></p>
<p><span style="color:#D2691E">The first parameter defines the horizontal radius and if the second parameter is missed the vertical radius.</span></p>
<p><span style="color:#228B22">The second parameter defines the vertical radius of the ellipse that defines the shape of the corner.</span></p>
<p>All of these properties set the only one specific corner.</p>
<p><strong>Examples:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* sets the top left corner */</span>
border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
&nbsp;
 <span style="color: #808080; font-style: italic;">/* sets the top right corner as in the picture above */</span>
border-top-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">55pt</span> <span style="color: #933;">25pt</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>More info on syntax you can find at W3C site:</strong> <a href="http://www.w3.org/TR/2010/WD-css3-background-20100612/#the-border-radius" target="_blank">http://www.w3.org/TR/2010/WD-css3-background-20100612/#the-border-radius</a>.</p>
<h3>Practice</h3>
<p>Let&#8217;s create a div the corners of which we will curve.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;curved-corners&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>To curve all the corners we should write these styles:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#curved-corners</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
	border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for WebKit browsers like: Safari, Chrome */</span>
	-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for Mozilla browsers like FireFox */</span>
	-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* Linux browsers */</span>
	-khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* maybe ALL IE  */</span>
	behavior<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">border-radius.htc</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>By the way, you should download border-radius.htc from Google Code and copy it to the location you need, and then specify the correct path to border-radius.htc. So, let&#8217;s look at the example above in work:</p>
<div style="position:relative;width:100px;height:50px;border:2px solid red;border-radius:20px;-webkit-border-radius:20px;-moz-border-radius:20px;-khtml-border-radius: 20px;behavior:url(/my-examples/files/border-radius.htc);background-color:#fff;"></div>
<p>Now, let&#8217;s curve only top left and bottom right borders. We are still using the same DIV but define another styles.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#curved-corners</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* CSS3 declaration */</span>
	border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
	border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for WebKit browsers like: Safari, Chrome */</span>
	-webkit-border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
	-webkit-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span> 
&nbsp;
        <span style="color: #808080; font-style: italic;">/* declaration for Mozilla browsers like FireFox */</span>
	-moz-border-radius-topleft<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	-moz-border-radius-bottomright<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
&nbsp;
        <span style="color: #808080; font-style: italic;">/* Linux browsers */</span>
	-khtml-border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
	-khtml-border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>We aren&#8217;t using htc file for IE because it cannot curve specific corners. It can curve all the four corners only. So, let&#8217;s see the example above at work:</p>
<div style="width:100px;height:50px;border:2px solid blue;border-top-left-radius:20px;border-bottom-right-radius: 20px;-webkit-border-top-left-radius:20px;-webkit-border-bottom-right-radius:20px;-moz-border-radius-topleft:20px;-moz-border-radius-bottomright:20px;-khtml-border-top-left-radius:20px;-khtml-border-bottom-right-radius:20px;"></div>
<h3>Conclusion</h3>
<p>After testing how CSS3 can round borders, I can say that it&#8217;s cool. Even if you want to curve borders in IE6+ there&#8217;s a workaround but it&#8217;s a bit limited. I hope that some issues for this IE htc file will be fixed soon. Microsoft promised that IE9 will support CCS3 technique to curve corners. By the way, there&#8217;re a lot of popular web sites that have already begun to use CSS3 technique to round corners.</p>
<h3>Links</h3>
<p><a href="http://www.w3.org/TR/2002/WD-css3-border-20021107/#the-border-radius">W3C CSS3 Border Radius</a></p>
<p><a href="http://www.w3.org/TR/2010/WD-css3-background-20100612/#the-border-radius">W3C CSS3 Border Radius newer doc</a></p>
<p><a href="http://code.google.com/p/curved-corner/">Rounded corner HTML elements using CSS3 in IE (Download at Google Code)</a></p>
<p><a href="http://css3pie.com/">PIE library</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/08/24/css3-rounded-corners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centering horizontal CSS menu</title>
		<link>http://starikovs.com/2009/12/04/centering-horizontal-css-menu/</link>
		<comments>http://starikovs.com/2009/12/04/centering-horizontal-css-menu/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 17:00:16 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[codecharge]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=176</guid>
		<description><![CDATA[It&#8217;s a real headache to center a fluid block element horizontally with help of CSS. Some time ago I figured out how to center CodeCharge Studio&#8217;s CSS Menu because it doesn&#8217;t provide this functionality. In general, any block element without the fixed width can be centered with help of this method. By the way, if [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a real headache to center a fluid block element horizontally with help of CSS. Some time ago I figured out how to center CodeCharge Studio&#8217;s CSS Menu because it doesn&#8217;t provide this functionality. In general, any block element without the fixed width can be centered with help of this method. </p>
<p>By the way, if You have a fixed width block then You have to set its left and right margins to auto and You get the block centered. </p>
<p>In this article I&#8217;m going to explain the method I use to center a fluid block element. Here is the <a href="http://starikovs.com/my-examples/centering-horizontal-css-menu/test.php" target="_blank">Demo</a>.</p>
<p><span id="more-176"></span></p>
<p>With help of this method You can center:</p>
<ul>
<li>CodeCharge Studio&#8217;s Menu (CCS Menu)</li>
<li>Horizontal CSS Menu</li>
<li>Any block elements (DIV, SPAN, IMG, UL, etc.)</li>
</ul>
<h3>HTML</h3>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- BEGIN Menu Menu1 --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;MenuStyle&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Menu1Container&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;adxm {Menu1:MenuType} level1&quot;</span>&gt;</span>
  ...
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- END Menu Menu1 --&gt;</span></pre></div></div>

<h3>CSS</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#Menu1Container</span> <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#Menu1Container</span> ul <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>Links</h3>
<p><a href="http://www.yessoftware.com/?2628" target="_blank">CodeCharge Studio&#8217;s web site</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/12/04/centering-horizontal-css-menu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Inline YUI AutoComplete layout</title>
		<link>http://starikovs.com/2009/11/04/inline-yui-autocomplete-layout/</link>
		<comments>http://starikovs.com/2009/11/04/inline-yui-autocomplete-layout/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 11:28:27 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=71</guid>
		<description><![CDATA[Recently, i had a problem with YUI AutoComplete layout. I wanted it being inline, fixed width and working with different browsers like IE6/7/8, Opera, FF etc. There were some problems that i solved primarily in CSS. More precisely, i needed an inline YUI AutoComplete layout in such a way that i can place autocomplete &#60;input&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://starikovs.com/wp-content/uploads/2009/11/yuiautocompletelayout.PNG" alt="Inline YUI AutoComplete layout" title="Inline YUI AutoComplete layout" width="281" height="81" class="alignleft size-full wp-image-73" /> Recently, i had a problem with YUI AutoComplete layout. I wanted it being inline, fixed width and working with different browsers like IE6/7/8, Opera, FF etc. There were some problems that i solved primarily in CSS. More precisely, i needed an inline YUI AutoComplete layout in such a way that i can place autocomplete &lt;input&gt; next to the &lt;label&gt; without a line break. I just set my styles in CSS and override some existing styles and it works ok!</p>
<p><strong>So, problems i had to solve for my needs:</strong></p>
<ul>
<li>an outer container is a DIV so INPUT always goes on the next line</li>
<li>inline-block for DIV doesn&#8217;t work in IE6/7</li>
<li>an outer container has width of 100%</li>
<li>INPUT is absolutely positioned so an outer DIV is collapsed</li>
<li>width of 100% makes INPUT 6px larger then outer DIV in IE6</li>
<li>using inline-block, INPUT aligns vertically on the bottom in IE6</li>
</ul>
<p><span id="more-71"></span></p>
<h3>YUI files to include</h3>
<p>Let&#8217;s begin with files to include:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--CSS file (default YUI Sam Skin) --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/autocomplete/assets/skins/sam/autocomplete.css&quot;</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- Dependencies --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/datasource/datasource-min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">&lt;!-- Source file --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://yui.yahooapis.com/2.8.0r4/build/autocomplete/autocomplete-min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<p>Well, i&#8217;m explaining below how i&#8217;ve achieved an inline YUI AutoComplete layout. The code is well-commented to understand what is happening <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>HTML</h3>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- </span>
<span style="color: #808080; font-style: italic;">Let's use SPAN becase it has &quot;display: inline&quot; by default.</span>
<span style="color: #808080; font-style: italic;">IE6/7 can apply &quot;display: inline-block&quot; only for elements</span>
<span style="color: #808080; font-style: italic;">that have &quot;display: inline&quot; by default.</span>
<span style="color: #808080; font-style: italic;">Read more: http://www.quirksmode.org/css/display.html.</span>
<span style="color: #808080; font-style: italic;">--&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input&quot;</span>&gt;</span>YUI AutoComplete<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;autocomplete&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;results&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
/* creating a data source out of js array */
var ds = new YAHOO.util.LocalDataSource([&quot;apples&quot;, &quot;apricots&quot;, &quot;bananas&quot;]);
&nbsp;
/* creating a yui autocomplete */
var ac = new YAHOO.widget.AutoComplete(&quot;input&quot;, &quot;results&quot;, ds);
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div>

<h3>CSS</h3>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* outer container */</span>
<span style="color: #cc00cc;">#autocomplete</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* behaving like an inline element */</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> -moz-inline-box<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* for FF less then 3.0 */</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span> !important<span style="color: #00AA00;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #808080; font-style: italic;">/* standard width of a textbox */</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">145px</span><span style="color: #00AA00;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* align vertically on the center */</span>
    <span style="color: #000000; font-weight: bold;">vertical-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">middle</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* input */</span>
<span style="color: #cc00cc;">#autocomplete</span> input <span style="color: #00AA00;">&#123;</span>
    <span style="color: #808080; font-style: italic;">/* preventing an outer container DIV collapsing */</span> 
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
    <span style="color: #808080; font-style: italic;">/* tweaking to traditional box model
     * width = border + padding + content
     */</span>
    box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
    -moz-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
    -webkit-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span>
    -ms-box-sizing<span style="color: #00AA00;">:</span> border-box<span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* ie8 */</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/* CSS Expression to calculate width for the input.
     * 2px border + 1px padding + 1px padding + 2px border = 6px.
     * Only for IE6/7 because traditional box model cannot
     * be tweaked by any css property.
     * currentStyle object - IE css styles as specified by 
     * global style sheets, inline styles, and HTML attributes.
     */</span>
    <span style="color: #00AA00;">*</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> expression<span style="color: #00AA00;">&#40;</span>parseInt<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">this.parentNode.currentStyle.width</span><span style="color: #00AA00;">&#41;</span>-<span style="color: #cc66cc;">6</span><span style="color: #00AA00;">+</span><span style="color: #ff0000;">'px'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>I&#8217;ve tested this soluting in <strong>FireFox 3.5</strong>, <strong>Opera 10</strong>, <strong>IE 6/7/8</strong>. YUI version i&#8217;m using is <strong>2.8</strong>.</p>
<h3>Further reading:</h3>
<ul>
<li><a href="http://developer.yahoo.com/yui/autocomplete/" target="_blank">YUI 2 Autocomplete</a></li>
<li><a href="http://www.quirksmode.org/css/box.html" target="_blank">CSS Box Models</a></li>
<li><a href="http://www.quirksmode.org/css/display.html" target="_blank">Display declarations</a></li>
<li><a href="http://wiki.orbeon.com/forms/doc/contributor-guide/ie-bugs#TOC-Inline-block" target="_blank">inline-block in IE</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms535889(VS.85).aspx" target="_blank">IE runtimeStyle Object</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms528441(VS.85).aspx" target="_blank">IE currentStyle Object</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms535898(VS.85).aspx" target="_blank">IE style Object</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/11/04/inline-yui-autocomplete-layout/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

