<?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>Robertdot, A Web Design Blog &#187; Tricks</title>
	<atom:link href="http://robertdot.org/tags/tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertdot.org</link>
	<description>A web design blog for designers that develop or developers that design.</description>
	<lastBuildDate>Fri, 05 Mar 2010 15:59:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Triangles in CSS</title>
		<link>http://robertdot.org/2009/03/25/triangles-in-css/</link>
		<comments>http://robertdot.org/2009/03/25/triangles-in-css/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 17:46:52 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tricks]]></category>

		<guid isPermaLink="false">http://robertdot.org/?p=179</guid>
		<description><![CDATA[
I was reading Image-free CSS Tooltip Pointers and realized the trick of triangles in CSS.  These odd little polygonal things have been around for awhile, but I just now figured out how the triangle works.


 Basically, where two borders meet (e.g. border-top and border-left), a diagonal line is drawn where they meet, making a [...]]]></description>
			<content:encoded><![CDATA[<p>
I was reading <a href="http://www.filamentgroup.com/lab/image_free_css_tooltip_pointers_a_use_for_polygonal_css/">Image-free CSS Tooltip Pointers</a> and realized the trick of triangles in <abbr title="Cascading Style Sheets">CSS</abbr>.  These odd little polygonal things have been around for awhile, but I just now figured out how the triangle works.
</p>
<p>
 Basically, where two borders meet (e.g. <code>border-top</code> and <code>border-left</code>), a diagonal line is drawn where they meet, making a neat bezel effect, rather than having the top border sit above the left border.  For example:
</p>
<div style="margin: auto; border: 10px solid red; border-left-color: blue; border-right-color: green; border-bottom-color: yellow; height: 20px; width: 20px; background: gray;"></div>
<p>
 On the <code>div</code> above, you can see the diagonal lines where the borders meet.
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="htmlstrict" style="font-family:monospace;">&lt;div style=&quot;margin: auto; border: 10px solid red; border-left-color: blue; border-right-color: green; border-bottom-color: yellow; height: 20px; width: 20px; background: gray;&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>
 Taking advantage of this, it&#8217;s easy to set the color of some borders to transparent and end up with a polygon.
</p>
<div style="margin: auto; border: 10px solid red; border-left-color: transparent; border-right-color: transparent; border-bottom-color: transparent; height: 0px; width: 20px;"></div>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="htmlstrict" style="font-family:monospace;">&lt;div style=&quot;margin: auto; border: 10px solid red; border-left-color: transparent; border-right-color: transparent; border-bottom-color: transparent; height: 20px; width: 20px;&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>
 Take that principle and mess around with it, and you can make triangles.  For example:
</p>
<div style="position: relative; width: 100px; height: 100px; margin: auto;">
<div style="width:0; height:0; border-left: 5px solid transparent;  border-right: 5px solid transparent; border-top: 5px solid blue; border-bottom: 0; position: absolute; bottom: 0px; left: 50%;"></div>
<div style="width:0; height:0; border-left: 5px solid transparent;  border-right: 5px solid transparent; border-bottom: 5px solid blue; border-top: 0; position: absolute; top: 0px; left: 50%;"></div>
<div style="width:0; height:0; border-top: 5px solid transparent;  border-bottom: 5px solid transparent; border-right: 5px solid blue; border-left: 0; position: absolute; top: 50%; left: 0px;"></div>
<div style="width:0; height:0; border-top: 5px solid transparent;  border-bottom: 5px solid transparent; border-left: 5px solid blue; border-right: 0; position: absolute; top: 50%; right: 0px;""></div>
<div style="width:0; height:0; border-left: 7px solid blue;  border-right: 7px solid transparent; border-top: 7px solid transparent; border-bottom: 0; position: absolute; bottom: 0px; left: 0px;""></div>
<div style="width:0; height:0; border-left: 7px solid blue;  border-right: 7px solid transparent; border-bottom: 7px solid transparent; border-top: 0; position: absolute; top: 0px; left: 0px;""></div>
<div style="width:0; height:0; border-left: 7px solid transparent;  border-right: 7px solid blue; border-bottom: 7px solid transparent; border-top: 0; position: absolute; top: 0px; right: 0px;""></div>
<div style="width:0; height:0; border-left: 7px solid transparent;  border-right: 7px solid blue; border-top: 7px solid transparent; border-bottom: 0; position: absolute; bottom: 0px; right: 0px;""></div>
</p></div>
<p>
 Above, you have north, south, east, west, northeast, northwest, southeast, and southwest (in no particular order).
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="htmlstrict" style="font-family:monospace;"> &lt;div style=&quot;position: relative; width: 100px; height: 100px; margin: auto;&quot;&gt;
  &lt;div style=&quot;width:0; height:0; border-left: 5px solid transparent;  border-right: 5px solid transparent; border-top: 5px solid blue; border-bottom: 0; position: absolute; bottom: 0px; left: 50%;&quot;&gt;&lt;/div&gt; 
  &lt;div style=&quot;width:0; height:0; border-left: 5px solid transparent;  border-right: 5px solid transparent; border-bottom: 5px solid blue; border-top: 0; position: absolute; top: 0px; left: 50%;&quot;&gt;&lt;/div&gt; 
  &lt;div style=&quot;width:0; height:0; border-top: 5px solid transparent;  border-bottom: 5px solid transparent; border-right: 5px solid blue; border-left: 0; position: absolute; top: 50%; left: 0px;&quot;&gt;&lt;/div&gt; 
  &lt;div style=&quot;width:0; height:0; border-top: 5px solid transparent;  border-bottom: 5px solid transparent; border-left: 5px solid blue; border-right: 0; position: absolute; top: 50%; right: 0px;&quot;&quot;&gt;&lt;/div&gt; 
  &lt;div style=&quot;width:0; height:0; border-left: 7px solid blue;  border-right: 7px solid transparent; border-top: 7px solid transparent; border-bottom: 0; position: absolute; bottom: 0px; left: 0px;&quot;&quot;&gt;&lt;/div&gt; 
  &lt;div style=&quot;width:0; height:0; border-left: 7px solid blue;  border-right: 7px solid transparent; border-bottom: 7px solid transparent; border-top: 0; position: absolute; top: 0px; left: 0px;&quot;&quot;&gt;&lt;/div&gt; 
  &lt;div style=&quot;width:0; height:0; border-left: 7px solid transparent;  border-right: 7px solid blue; border-bottom: 7px solid transparent; border-top: 0; position: absolute; top: 0px; right: 0px;&quot;&quot;&gt;&lt;/div&gt; 
  &lt;div style=&quot;width:0; height:0; border-left: 7px solid transparent;  border-right: 7px solid blue; border-top: 7px solid transparent; border-bottom: 0; position: absolute; bottom: 0px; right: 0px;&quot;&quot;&gt;&lt;/div&gt; 
 &lt;/div&gt;</pre></td></tr></table></div>

<p>
 So, as you can see, it&#8217;s pretty easy to make a triangle.  Adjust the border widths to make them bigger.</p>
]]></content:encoded>
			<wfw:commentRss>http://robertdot.org/2009/03/25/triangles-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
