尝试在移动设备上使用堆叠选项卡

问题描述 投票:0回答:1

我试图让按钮在移动设备上全宽,选项卡式内容在移动设备上全宽,其他所有内容都应该是第 2 列按钮和第 10 列内容

.tab-content>.tab-pane,
.pill-content>.pill-pane {
  display: none;
}

.tab-content>.active,
.pill-content>.active {
  display: block;
}

.double-border {
  --b: 2px;
  /* thickness */
  --c: #3CD5AF;
  height: 100%;
  border-right: var(--b) solid var(--c);
  border-left: var(--b) solid var(--c);
  background: linear-gradient(var(--c) 0 0) left 10px bottom 0/var(--b) 50% no-repeat, linear-gradient(var(--c) 0 0) right 10px bottom 0/var(--b) 50% no-repeat
}

.btn-new {
  flex: 1 1 auto;
  text-transform: uppercase;
  transition: 0.5s;
  background-size: 200% auto;
  color: black;
  box-shadow: 4px 6px 8px 0 rgb(0 0 0 / 10%), 0 6px 20px 0 rgb(255 255 255 / 10%);
  background: white;
}

.btn-new.active {
  flex: 1 1 auto;
  text-transform: uppercase;
  transition: 0.5s;
  background-size: 200% auto;
  h4 {
    color: white;
  }
  small {
    color: white;
  }
}

.btn-new.h4.active {
  color: white;
}


/* Demo Stuff End -> */


/* <- Magic Stuff Start */

.btn-new:hover {
  background-position: right center;
  /* change the direction of the change here */
}

.btn-1.active {
  background-image: linear-gradient(to right, #006072 0%, #000000 51%, #006072 100%);
}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />




<section <?php theme_section_attr_id() ?>
  <?php theme_section_attr_class( 'main-section position-relative' ) ?>
  <div class="container">
    <div class="row">
      <h1 class="text-center pb-3">In house <strong style="font-weight:700;">Schedule</strong></h1>
      <div class="d-flex align-items-start">
        <div class="nav col-sm-12 col-2 flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
          <button class="nav-link border-0 btn-new btn-1 px-3 pb-0 pt-3 mb-4 active text-start" id="v-pills-1-tab" data-bs-toggle="pill" data-bs-target="#v-pills-1" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">
                    <small class="m-0">Tuesday</small>
                    <h4 class="text-capitalize" style="font-weight: 600;">May 7th</h4>
                    </button>
          <button class="nav-link border-0 btn-new btn-1 px-3 pb-0 pt-3 mb-4 text-start " id="v-pills-2-tab" data-bs-toggle="pill" data-bs-target="#v-pills-2" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">
                    <small class="m-0">Wednesday</small>
                    <h4 class="text-capitalize" style="font-weight: 600;">May 8th</h4>
                    </button>
        </div>

        <div class="tab-content col-sm-12 col-10" id="v-pills-tabContent">
          <div class="tab-pane fade show active" id="v-pills-1" role="tabpanel" aria-labelledby="v-pills-1-tab">

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 10:00 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/themes/t220908406929/dist/images/logo-dark.svg" alt="" class="img-fluid">
              </div>
            </div>

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 10:30 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/uploads/2024/04/Group-1000002059.png" alt="" class="img-fluid">
              </div>
            </div>

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 11:00 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/themes/t220908406929/dist/images/logo-dark.svg" alt="" class="img-fluid">
              </div>
            </div>



          </div>

          <div class="tab-pane fade show " id="v-pills-2" role="tabpanel" aria-labelledby="v-pills-2-tab">

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 10:00 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text.</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/themes/t220908406929/dist/images/logo-dark.svg" alt="" class="img-fluid">
              </div>
            </div>



          </div>
        </div>
      </div>
    </div>


  </div>
  </div>
</section>

瞄准

移动视图按钮为 100%,内容为 100% 如此堆叠,按钮在顶部,内容在下面

html css twitter-bootstrap tabs nav-pills
1个回答
0
投票

有这样的事吗?我希望这是你想要的。

通常,了解像

w-md-auto
w-100
这样的类是很有好处的。所有内容都记录在Bootstrap Documentation中。

.tab-content>.tab-pane,
.pill-content>.pill-pane {
  display: none;
}

.tab-content>.active,
.pill-content>.active {
  display: block;
}

.double-border {
  --b: 2px;
  /* thickness */
  --c: #3CD5AF;
  height: 100%;
  border-right: var(--b) solid var(--c);
  border-left: var(--b) solid var(--c);
  background: linear-gradient(var(--c) 0 0) left 10px bottom 0/var(--b) 50% no-repeat, linear-gradient(var(--c) 0 0) right 10px bottom 0/var(--b) 50% no-repeat
}

.btn-new {
  flex: 1 1 auto;
  text-transform: uppercase;
  transition: 0.5s;
  background-size: 200% auto;
  color: black;
  box-shadow: 4px 6px 8px 0 rgb(0 0 0 / 10%), 0 6px 20px 0 rgb(255 255 255 / 10%);
  background: white;
}

.btn-new.active {
  flex: 1 1 auto;
  text-transform: uppercase;
  transition: 0.5s;
  background-size: 200% auto;
  h4 {
    color: white;
  }
  small {
    color: white;
  }
}

.btn-new.h4.active {
  color: white;
}


/* Demo Stuff End -> */


/* <- Magic Stuff Start */

.btn-new:hover {
  background-position: right center;
  /* change the direction of the change here */
}

.btn-1.active {
  background-image: linear-gradient(to right, #006072 0%, #000000 51%, #006072 100%);
}
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />




<section <?php theme_section_attr_id() ?>
  <?php theme_section_attr_class( 'main-section position-relative' ) ?>
  <div class="container-fluid">
    <div class="row">
      <h1 class="text-center pb-3">In house <strong style="font-weight:700;">Schedule</strong></h1>
      <div class="col-md-2 d-flex align-items-start">
        <div class=" w-100 w-md-auto nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
          <button class="nav-link border-0 btn-new btn-1 px-3 pb-0 pt-3 mb-4 active text-start" id="v-pills-1-tab" data-bs-toggle="pill" data-bs-target="#v-pills-1" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">
            <small class="m-0">Tuesday</small>
            <h4 class="text-capitalize" style="font-weight: 600;">May 7th</h4>
          </button>
          <button class="nav-link border-0 btn-new btn-1 px-3 pb-0 pt-3 mb-4 text-start w-100 w-sm-auto" id="v-pills-2-tab" data-bs-toggle="pill" data-bs-target="#v-pills-2" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">
            <small class="m-0">Wednesday</small>
            <h4 class="text-capitalize" style="font-weight: 600;">May 8th</h4>
          </button>
        </div>
      </div>

      <div class="col-md-10">
        <div class="tab-content" id="v-pills-tabContent">
          <div class="tab-pane fade show active" id="v-pills-1" role="tabpanel" aria-labelledby="v-pills-1-tab">

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 10:00 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/themes/t220908406929/dist/images/logo-dark.svg" alt="" class="img-fluid">
              </div>
            </div>

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 10:30 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/uploads/2024/04/Group-1000002059.png" alt="" class="img-fluid">
              </div>
            </div>

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 11:00 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/themes/t220908406929/dist/images/logo-dark.svg" alt="" class="img-fluid">
              </div>
            </div>



          </div>

          <div class="tab-pane fade show " id="v-pills-2" role="tabpanel" aria-labelledby="v-pills-2-tab">

            <div class="row pb-5">
              <div class="col-lg-2 text-center">
                <strong> 10:00 AM </strong>
              </div>
              <div class="col-lg-8 double-border px-5">
                <strong>title</strong>
                <p class="mt-2">text.</p>
                <a hreff="">link</a></a>
              </div>
              <div class="col-lg-2 d-flex align-items-center justify-content-center">
                <img src="/wp-content/themes/t220908406929/dist/images/logo-dark.svg" alt="" class="img-fluid">
              </div>
            </div>



          </div>
        </div>
      </div>
    </div>


  </div>
  </div>
</section>

© www.soinside.com 2019 - 2024. All rights reserved.