简体   繁体   English

物化 CSS 垂直标签位置

[英]Materialize CSS Vertical Tabs Position

I have created vertical tabs with materialize CSS but what I am not able to do is positioning.我已经使用 materialize CSS 创建了垂直选项卡,但我无法做的是定位。 I want result like this.我想要这样的结果。 When clicking on TAB 3, content should be started from same level.单击 TAB 3 时,内容应从同一级别开始。 在此处输入图片说明

Here is my HTML这是我的 HTML

<div class="container">
  <div class="row">
    <div class="col m4">
      <ul class="tabs">
        <li class="tab"><a href="#test1">Tab 1</a></li>
        <li class="tab"><a class="active" href="#test2">Tab 2</a></li>
        <li class="tab"><a href="#test3">Tab 3</a></li>
        <li class="tab"><a href="#test4">Tab 4</a></li>
        <li class="tab"><a href="#test5">Tab 5</a></li>
        <li class="tab"><a href="#test6">Tab 6</a></li>
      </ul>
    </div>
    <div class="col m8">
      <div id="test1" class="col tab-content">Tab 1</div>
      <div id="test2" class="col tab-content">Tab 2</div>
      <div id="test3" class="col tab-content">Tab 3</div>
      <div id="test4" class="col tab-content">Tab 4</div>
      <div id="test5" class="col tab-content">Tab 4</div>
      <div id="test6" class="col tab-content">Tab 4</div>
    </div>
  </div>
</div>

And CSS和 CSS

.tabs{
height: auto;
white-space: normal;
}
.tab{
display: block;
width: 100%;
border-bottom: 1px solid #f0f0f0;
}
.tab-content{
height: 200px;
width: 100%;
background: #fcfcfc;
border:1px solid #f0f0f0;
}
.indicator{
display: none;
}

for those who only want use extreme simple tab, nothing else, please use this link my simple materialized css vertial tab对于那些只想使用极端简单选项卡的人,别无其他,请使用此链接我的简单物化 css 垂直选项卡

for those who want to use advanced full page css layout similar to my css style please use this link This is my working codepen对于那些想要使用类似于我的 css 样式的高级全页 css 布局的人,请使用此链接这是我的工作代码笔

The idea is that original materializedcss 1.0.0 do not support vertical tab!!!这个想法是原来的materializedcss 1.0.0不支持垂直制表符!!!

They are not going to do so, you must modify overwrite of original tab css to convert it to a vertial他们不会这样做,您必须修改原始选项卡 css 的覆盖以将其转换为垂直

How to?如何? see my scss, you must compile it to css before add to your style tag查看我的 scss,您必须先将其编译为 css,然后再添加到您的样式标签

.tabs-vertical {
.tabs {
    height: auto;
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    flex-direction: column;
    display: -webkit-flex;
    display: flex;
  
}

.tab {
    width: 100%;

    .active {
        -moz-transition: border-color .5s ease;
        -o-transition: border-color .5s ease;
        -webkit-transition: border-color .5s ease;
        transition: border-color .5s ease;
        border-right: 3px solid #424242;
    }

    :hover {
        border-right: 3px solid #eeeeee;
    }
}

.indicator {
    display: none;
}

    .tab-content {
    display : none
  }

    > .tab-content .active{
    display : block
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM