Skip to content

Instantly share code, notes, and snippets.

@tikitikipoo
Created February 10, 2012 01:37
Show Gist options
  • Save tikitikipoo/1785255 to your computer and use it in GitHub Desktop.
Save tikitikipoo/1785255 to your computer and use it in GitHub Desktop.
CSSで矢印を表現
/* http://www.bookofzeus.com/articles/create-css-arrows/ */
ul
{
list-style-type: none;
position: relative;
}
li {
list-style-type: none;
background-color: #ddd;
border-right: solid 1px #aaa;
height: 26px;
position: relative;
width: 100px;
float:left;
text-align:center;
}
li:last-child {
border-right: none;
}
li.selected:after {
content: ' ';
height: 0;
position: absolute;
width: 0;
border: 10px solid transparent;
border-top-color: #ddd;
top: 100%;
left: 50%;
margin-left: -10px;
}
li a {
display: inline-block;
color:#444;
text-decoration: none;
font: normal 12px verdana;
line-height: 19px;
padding: 4px;
}
.arrowUp {
border-top: 12px solid #ddd;
border-left: 12px solid transparent;
border-right: 12px solid transparent;
font-size: 0;
line-height: 0;
width: 0;
}
.arrowDown {
border-bottom: 12px solid #ddd;
border-left: 12px solid transparent;
border-right: 12px solid transparent;
font-size: 0;
line-height: 0;
width: 0;
}
.arrowRight {
border-left: 12px solid #ddd;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-right: 12px solid transparent;
font-size: 0;
line-height: 0;
width: 0;
}
.arrowLeft {
border-left: 12px solid transparent;
border-top: 12px solid transparent;
border-bottom: 12px solid transparent;
border-right: 12px solid #ddd;
font-size: 0;
line-height: 0;
width: 0;
}
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<!-- 出所:http://www.bookofzeus.com/articles/create-css-arrows/ -->
<div class="arrowUp"></div>
<div class="arrowRight"></div>
<div class="arrowDown"></div>
<div class="arrowLeft"></div>
<ul>
<li><a href="#">Menu 1</a></li>
<li><a href="#">Menu 2</a></li>
<li class="selected"><a href="#">Menu 3</a></li>
<li><a href="#">Menu 4</a></li>
<li><a href="#">Menu 5</a></li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment