<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"><title>The Canadian Flag, In CSS</title><author><name>Matt Read</name></author><link rel="alternate" href="https://mattread.com/the-canadian-flag-in-css"/><link rel="edit" href="https://mattread.com/the-canadian-flag-in-css/atom"/><id>http://mattread.com/archives/2005/03/the-canadian-flag-in-css/</id><updated>2007-04-06T14:58:21-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-25T14:35:19-04:00</app:edited><published>2005-03-01T17:54:38-05:00</published><category term="web-design"/><category term="web-applications"/><category term="internet"/><content type="html">&lt;p&gt;I was over at Stu Nicholls today and saw this really cool &lt;a href="http://www.stunicholls.myby.co.uk/menu/britain.html"&gt;British flag&lt;/a&gt; completely done up in CSS. So I investigated a little futher, figured out how to do "diagonals" in CSS, and started work on my own. &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;After wasting about an hour and a half, I came up with my version of the Canadian Flag below. Yes that's right &lt;em&gt;all&lt;/em&gt; done in CSS, including the maple leaf. The maple leaf is a little ... off, but still, it was fun trying to figure out what triangles go where. And if you have IE, well it probably won't work, sorry. But let me know what you think. ...&lt;/p&gt;&#xD;
&#xD;
&lt;div&gt;&#xD;
&lt;style type="text/css"&gt;&#xD;
    /* &lt;![CDATA[ */&#xD;
      &#xD;
    .flag-back {&#xD;
    position:absolute;&#xD;
    top: 0;&#xD;
    left: 65px;&#xD;
    width: 200px;&#xD;
    height: 160px;&#xD;
    border-left: 50px solid #c00;&#xD;
    border-right: 50px solid #c00;&#xD;
    background-color: #fff;&#xD;
    }&#xD;
    &#xD;
    .main-tri {&#xD;
    display:block;&#xD;
    width:0;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-right:42px solid #fff;&#xD;
    border-left:42px solid #fff;&#xD;
    border-bottom:120px solid #c00;&#xD;
    position:absolute;&#xD;
    top: 5px;&#xD;
    left: 170px;&#xD;
    z-index: 3;&#xD;
    }&#xD;
    &#xD;
    .sec-main-tri {&#xD;
    display:block;&#xD;
    width:25px;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-right:20px solid transparent;&#xD;
    border-left:20px solid transparent;&#xD;
    border-top:60px solid #c00;&#xD;
    position:absolute;&#xD;
    top: 45px;&#xD;
    left: 180px;&#xD;
    z-index: 3;&#xD;
    }&#xD;
    &#xD;
    .right-main-tri {&#xD;
    display:block;&#xD;
    width:0;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-right:50px solid transparent;&#xD;
    border-top:50px solid #c00;&#xD;
    position:absolute;&#xD;
    top: 75px;&#xD;
    left: 235px;&#xD;
    z-index: 5;&#xD;
    }&#xD;
    &#xD;
    .right-top-tri {&#xD;
    display:block;&#xD;
    width:0;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-right:20px solid #c00;&#xD;
    border-top:20px solid transparent;&#xD;
    position:absolute;&#xD;
    top: 55px;&#xD;
    left: 235px;&#xD;
    z-index: 5;&#xD;
    }&#xD;
    &#xD;
    .right-bot-tri {&#xD;
    display:block;&#xD;
    width:0;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-left:30px solid #c00;&#xD;
    border-top:30px solid transparent;&#xD;
    position:absolute;&#xD;
    top: 82px;&#xD;
    left: 250px;&#xD;
    z-index: 5;&#xD;
    }&#xD;
    &#xD;
    .left-main-tri {&#xD;
    display:block;&#xD;
    width:0;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-left:50px solid transparent;&#xD;
    border-top:50px solid #c00;&#xD;
    position:absolute;&#xD;
    top: 75px;&#xD;
    left: 145px;&#xD;
    z-index: 5;&#xD;
    }&#xD;
    &#xD;
    .left-top-tri {&#xD;
    display:block;&#xD;
    width:0;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-left:20px solid #c00;&#xD;
    border-top:20px solid transparent;&#xD;
    position:absolute;&#xD;
    top: 55px;&#xD;
    left: 170px;&#xD;
    z-index: 5;&#xD;
    }&#xD;
    &#xD;
    .left-bot-tri {&#xD;
    display:block;&#xD;
    width:0;&#xD;
    height:0;&#xD;
    overflow:hidden;&#xD;
    border-right:30px solid #c00;&#xD;
    border-top:30px solid transparent;&#xD;
    position:absolute;&#xD;
    top: 82px;&#xD;
    left: 150px;&#xD;
    z-index: 5;&#xD;
    }&#xD;
    &#xD;
    .stem {&#xD;
    display:block;&#xD;
    width:10px;&#xD;
    height:20px;&#xD;
    background-color:#c00;&#xD;
    overflow:hidden;&#xD;
    position:absolute;&#xD;
    top: 125px;&#xD;
    left: 206px;&#xD;
    z-index: 5;&#xD;
    }&#xD;
    &#xD;
    /* ]]&gt; */&#xD;
    &lt;/style&gt;&#xD;
&#xD;
&lt;h2&gt;CSS Flag&lt;/h2&gt;&#xD;
&#xD;
&lt;div style="position:relative; height: 200px;"&gt;&#xD;
&lt;div class="flag-back"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&#xD;
&lt;div class="main-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&lt;div class="sec-main-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&#xD;
&lt;div class="left-top-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&lt;div class="left-main-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&lt;div class="left-bot-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&#xD;
&lt;div class="right-top-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&lt;div class="right-main-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&lt;div class="right-bot-tri"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&#xD;
&lt;div class="stem"&gt;&amp;nbsp;&lt;/div&gt;&#xD;
&lt;/div&gt;&#xD;
&lt;/div&gt;&#xD;
</content></entry>
