Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
Created September 2, 2008 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriseppstein/8387 to your computer and use it in GitHub Desktop.
Save chriseppstein/8387 to your computer and use it in GitHub Desktop.
.compass { margin: 1em auto; position: relative; width: 16em; height: 16em; font-size: 24px; font-family: "Academy Engraved LET", "Papyrus"; }
.compass .n, .compass .s, .compass .e, .compass .w { position: absolute; width: 4em; height: 4em; text-align: center; vertical-align: middle; }
.compass .w { left: 0px; }
.compass .n.w, .compass .s.w { left: 2em; }
.compass .n, .compass .s { left: 6em; }
.compass .n.e, .compass .s.e { left: 10em; }
.compass .e { left: 12em; }
.compass .n { top: 0px; }
.compass .n.w, .compass .n.e { top: 2em; }
.compass .w, .compass .e { top: 6em; }
.compass .s.w, .compass .s.e { top: 10em; }
.compass .s { top: 12em; }
.compass .n p, .compass .s p, .compass .e p, .compass .w p { margin-top: 1.5em; margin-bottom: 1.5em; }
.compass .n.w p, .compass .s.w p, .compass .n.e p, .compass .s.e p { margin-top: 1em; margin-bottom: 1em; }
<html>
<head>
<title>Compass Example</title>
<link rel="stylesheet" href="stylesheets/compass.css" type="text/css" media="screen, projection">
</head>
<body>
<div class="compass">
<div class="n"><p>North</p></div>
<div class="n e"><p>North<br/>East</p></div>
<div class="e"><p>East</p></div>
<div class="s e"><p>South<br/>East</p></div>
<div class="s"><p>South</p></div>
<div class="s w"><p>South<br/>West</p></div>
<div class="w"><p>West</p></div>
<div class="n w"><p>North<br/>West</p></div>
</div>
</body>
</html>
=compass(!s)
:position relative
:width= 4 * !s
:height= 4 * !s
.n, .s, .e, .w
:position absolute
:width= !s
:height= !s
:text-align center
:vertical-align middle
.w
:left 0px
.n.w, .s.w
:left= 0.5 * !s
.n, .s
:left= 1.5 * !s
.n.e, .s.e
:left= 2.5 * !s
.e
:left= 3 * !s
.n
:top 0px
.n.w, .n.e
:top= 0.5 * !s
.w, .e
:top= 1.5 * !s
.s.w, .s.e
:top= 2.5 * !s
.s
:top= 3 * !s
.compass
:font-size 24px
:font-family "Academy Engraved LET", "Papyrus"
:margin 1em auto
+compass(4em)
.n, .s, .e, .w
p
:margin
:top 1.5em
:bottom 1.5em
.n.w, .s.w, .n.e, .s.e
p
:margin
:top 1em
:bottom 1em
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment