motionsites中文站 / 按钮 · Curly Shrimp
按钮 · Curly Shrimp
aadmin2026-09-19 发布组件0 阅读

按钮 · Curly Shrimp

类型:组件 · 分类:按钮 · 收录:2026-09-19 · 源码:会员可见

[hidecontent type="vip1"]
<div class="tab-container">
  <input type="radio" name="tab" id="tab1" class="tab tab--1" />
  <label class="tab_label" for="tab1">Profile</label>

  <input type="radio" name="tab" id="tab2" class="tab tab--2" />
  <label class="tab_label" for="tab2">Settings</label>

  <input type="radio" name="tab" id="tab3" class="tab tab--3" />
  <label class="tab_label" for="tab3">Notifications</label>

  <div class="indicator"></div>
</div>

<style>
/* From Uiverse.io by zanina-yassine  - Tags: minimalist, ios, navigation, tabs */
/* Remove this container when use*/
.component-title {
  width: 100%;
  position: absolute;
  z-index: 999;
  top: 30px;
  left: 0;
  padding: 0;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #888;
  text-align: center;
}

.tab-container {
  position: relative;

  display: flex;
  flex-direction: row;
  align-items: flex-start;

  padding: 2px;

  background-color: #dadadb;
  border-radius: 9px;
}

.indicator {
  content: "";
  width: 130px;
  height: 28px;
  background: #ffffff;
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 9;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.12), 0px 3px 1px rgba(0, 0, 0, 0.04);
  border-radius: 7px;
  transition: all 0.2s ease-out;
}

.tab {
  width: 130px;
  height: 28px;
  position: absolute;
  z-index: 99;
  outline: none;
  opacity: 0;
}

.tab_label {
  width: 130px;
  height: 28px;

  position: relative;
  z-index: 999;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 0;

  font-size: 0.75rem;
  opacity: 0.6;

  cursor: pointer;
}

.tab--1:checked ~ .indicator {
  left: 2px;
}

.tab--2:checked ~ .indicator {
  left: calc(130px + 2px);
}

.tab--3:checked ~ .indicator {
  left: calc(130px * 2 + 2px);
}

</style>
    
[/hidecontent]
← 返回首页