← 一覧へ

Tab Menu / 18 メタリック|Metallic

デザイン見本

  • Tab 1
  • Tab 2
  • Tab 3
Good morning. This is the content of Tab 1.
Hello. This is the content of Tab 2.
Good evening. This is the content of Tab 3.

金属的な光沢と重厚感のあるメタリックデザインです。鈍く光るグラデーションと鋭いハイライトが、高級感や堅牢さを演出します。ガジェットや自動車、工具など、ハードウェアに関連するサイトに最適です。

実装コード

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 {
  overflow: hidden;
  border-radius: 12px;
  position: relative;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  border: 2px solid #95a5a6;
  box-shadow: 
      0 8px 32px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tab-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
      repeating-linear-gradient(
          45deg,
          transparent,
          transparent 10px,
          rgba(255, 255, 255, 0.03) 10px,
          rgba(255, 255, 255, 0.03) 20px
      );
  pointer-events: none;
}

.tab-container ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  position: relative;
  border-bottom: 2px solid #95a5a6;
}

.tab-container ul::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
      transparent 0%, 
      #ecf0f1 50%, 
      transparent 100%);
  animation: metallicShine 3s ease-in-out infinite;
}

@keyframes metallicShine {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.tab-container ul li {
  flex: 1;
  padding: 18px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  color: #bdc3c7;
  font-weight: 600;
  font-family: 'Arial', sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-right: 1px solid #7f8c8d;
  background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.tab-container ul li:last-child {
  border-right: none;
}

.tab-container ul li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
      rgba(255, 255, 255, 0.1) 0%, 
      rgba(255, 255, 255, 0.05) 50%, 
      rgba(255, 255, 255, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tab-container ul li:hover::before {
  opacity: 1;
}

.tab-container ul li.selected {
  color: #ecf0f1;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  box-shadow: 
      0 4px 16px rgba(231, 76, 60, 0.5),
      inset 0 2px 4px rgba(255, 255, 255, 0.2),
      inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  font-weight: 700;
  animation: metallicPulse 2s ease-in-out infinite alternate;
}

@keyframes metallicPulse {
  from { 
      box-shadow: 
          0 4px 16px rgba(231, 76, 60, 0.5),
          inset 0 2px 4px rgba(255, 255, 255, 0.2),
          inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  }
  to { 
      box-shadow: 
          0 6px 20px rgba(231, 76, 60, 0.7),
          inset 0 2px 4px rgba(255, 255, 255, 0.3),
          inset 0 -2px 4px rgba(0, 0, 0, 0.4);
  }
}

.tab-container ul li.selected::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #e74c3c, #c0392b);
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
}

.tab-container ul li:not(.selected):hover {
  background: linear-gradient(135deg, #3d4852 0%, #2c3e50 100%);
  color: #ecf0f1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  transform: translateY(-1px);
  box-shadow: 
      0 2px 8px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.tab-container .tab-content {
  display: none;
  padding: 30px;
  min-height: 180px;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #ecf0f1;
  border-radius: 0 0 12px 12px;
  box-shadow: 
      0 4px 16px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid #95a5a6;
  border-top: none;
  position: relative;
  overflow: hidden;
}

.tab-container .tab-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
      repeating-linear-gradient(
          90deg,
          transparent,
          transparent 30px,
          rgba(255, 255, 255, 0.02) 30px,
          rgba(255, 255, 255, 0.02) 32px
      );
  pointer-events: none;
}

.tab-container .tab-content.selected {
  display: block;
  animation: metallicFadeIn 0.5s ease;
}

@keyframes metallicFadeIn {
  from { 
      opacity: 0; 
      transform: translateY(-15px);
      box-shadow: 
          0 2px 8px rgba(0, 0, 0, 0.4),
          inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
  to { 
      opacity: 1; 
      transform: translateY(0);
      box-shadow: 
          0 4px 16px rgba(0, 0, 0, 0.4),
          inset 0 1px 0 rgba(255, 255, 255, 0.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');
  });
});