Facebook Icon in CSS Using a Single Div
Aug 2011
15
I was inspired by the idea that you can make a wide range of shapes using only CSS on a single div after reading this css-trics.com page. I created the Facebook Icon using a single div:
<div id="f"></div>
#f { width: 100px; height: 80px; background-color: #3B5998; border-bottom: 20px solid #6d84b4; position: relative; } #f:before { position: absolute; top: 15px; right: 15px; border: 15px solid #fff; border-bottom: none; border-right: none; border-top-left-radius: 15px; width: 15px; height: 65px; content: ""; } #f:after { position: absolute; top: 44px; left: 43px; height: 15px; width: 42px; background-color: #fff; content: ""; }
It works in Firefox 5, Chrome 13, and Safari 5.1. It works in IE8, but the "f" is not rounded. See the JS Fiddle version.
1 comment

Neat!