Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save watershed/1080201 to your computer and use it in GitHub Desktop.
Save watershed/1080201 to your computer and use it in GitHub Desktop.
skew_whiff.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>A menu experiment with slanting list items</title>
<style type="text/css" title="text/css" media="screen">
<!--
* {margin: 0; padding: 0;}
body {font-family: sans-serif;}
a {color: #fff; text-decoration: none;}
ul {list-style: none; overflow: hidden;}
li,
li b,
li span,
li i {float: left; line-height: 40px; display: block;}
li {margin-right: -39px;}
li a
{
display: block;
background: #ccc;
padding: 0 10px;
}
li span {background: #f00; padding: 0 15px;}
li b,
li i
{
display: block;
border-bottom: 40px solid #f00;
border-left: 20px solid transparent;
}
li i
{
border: 0;
border-top: 40px solid #f00;
border-right: 20px solid transparent;
}
li a:hover span {background: #666;}
li a:hover b {border-bottom: 40px solid #666;}
li a:hover i {border-top: 40px solid #666;}
li:first-child b {border-left: 0; width: 10px;}
li.last i {border-right: 0; width: 10px;}
-->
</style>
</head>
<body>
<ul>
<li><a href="#"><b></b><span>Ooh</span><i></i></a></li>
<li><a href="#"><b></b><span>Look</span><i></i></a></li>
<li><a href="#"><b></b><span>It’s</span><i></i></a></li>
<li class="last"><a href="#"><b></b><span>Skewed</span><i></i></a></li>
</ul>
</body>
</html>
@watershed
Copy link
Author

This ain't pretty. It was just a proof of concept using borders to generate the slants.

Would need tweaking for IE6 which doesn't support transparent borders. Should be fine with flat colour backgrounds.

Gradient backgrounds would require CSS3 transforms to achieve the slants instead. But that's a whole different approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment