Tab Menu / 11 付箋風|Sticky Note
デザイン見本
- Tab 1
- Tab 2
- Tab 3
Tab 1 Content
This is the content of Tab 1 in the sticky note style design. It features a yellow sticky note appearance with a friendly and approachable design.
Tab 2 Content
This is the content of Tab 2 in the sticky note style design. It's a simple and user-friendly design.
Tab 3 Content
This is the content of Tab 3 in the sticky note style design. It recreates the natural appearance of sticky notes.
ノートに貼られた付箋(ふせん)を模したアナログ感のあるデザインです。選択されたタブが少し浮き上がり、ドロップシャドウで立体感を表現しています。情報整理ツールや教育系サイトなど、親しみやすさを重視する場合におすすめです。
実装コード
HTML
<div class="tab-container">
<ul>
<li class="selected" data-id="tab-1">Tab 1</li>
<li data-id="tab-2">Tab 2</li>
<li data-id="tab-3">Tab 3</li>
</ul>
<div class="tab-content selected" id="tab-1">
Tab 1 のコンテンツ
</div>
<div class="tab-content" id="tab-2">
Tab 2 のコンテンツ
</div>
<div class="tab-content" id="tab-3">
Tab 3 のコンテンツ
</div>
</div>
CSS
.tab-container {
border-radius: 0;
position: relative;
}
.tab-container ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
gap: 8px;
margin-bottom: 20px;
position: relative;
}
.tab-container ul li {
flex: 1;
padding: 16px 20px;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
color: #666;
font-weight: 500;
font-family: 'Arial', sans-serif;
background: #fff;
border: 1px solid #ddd;
border-radius: 8px 8px 0 0;
box-shadow:
0 2px 4px rgba(0, 0, 0, 0.1),
0 1px 3px rgba(0, 0, 0, 0.08);
transform: rotate(0deg);
transform-origin: bottom center;
}
.tab-container ul li::before {
content: '';
position: absolute;
top: -8px;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 8px solid #fff;
opacity: 0;
transition: opacity 0.3s ease;
}
.tab-container ul li.selected {
color: #333;
background: #fff9c4;
border-color: #fbc02d;
box-shadow:
0 4px 12px rgba(251, 192, 45, 0.3),
0 2px 6px rgba(0, 0, 0, 0.15);
transform: rotate(0deg) translateY(-4px);
z-index: 3;
}
.tab-container ul li.selected::before {
opacity: 1;
border-bottom-color: #fff9c4;
}
.tab-container ul li.selected::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background:
repeating-linear-gradient(
45deg,
transparent,
transparent 2px,
rgba(251, 192, 45, 0.1) 2px,
rgba(251, 192, 45, 0.1) 4px
);
border-radius: 8px 8px 0 0;
pointer-events: none;
}
.tab-container ul li:not(.selected):hover {
background: #fff8e1;
border-color: #ffb300;
transform: rotate(0deg) translateY(-2px);
box-shadow:
0 3px 8px rgba(255, 179, 0, 0.2),
0 2px 4px rgba(0, 0, 0, 0.1);
}
.tab-container .tab-content {
display: none;
padding: 30px;
min-height: 180px;
background: #fff;
color: #333;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow:
0 4px 12px rgba(0, 0, 0, 0.1),
inset 0 1px 0 rgba(255, 255, 255, 0.8);
position: relative;
margin-top: 10px;
}
.tab-container .tab-content::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, #fff9c4, #fbc02d, #fff9c4);
border-radius: 8px 8px 0 0;
}
.tab-container .tab-content.selected {
display: block;
animation: stickyNoteIn 0.4s ease;
}
@keyframes stickyNoteIn {
from {
opacity: 0;
transform: translateY(-10px) scale(0.95);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
JS
const tabContainer = document.querySelector('.tab-container');
const tabMenuItems = tabContainer.querySelectorAll('ul li');
const tabContents = tabContainer.querySelectorAll('.tab-content');
tabMenuItems.forEach(tabMenuItem => {
tabMenuItem.addEventListener('click', () => {
tabMenuItems.forEach(item => {
item.classList.remove('selected');
});
tabMenuItem.classList.add('selected');
tabContents.forEach(tabContent => {
tabContent.classList.remove('selected');
});
document.getElementById(tabMenuItem.dataset.id).classList.add('selected');
});
});