CSS меню со стрелкой вниз

a:hover,a:focus{
    text-decoration: none;
    outline: none;
}
.tab .nav-tabs{
    border-bottom: 2px solid #ddd;
}
.tab .nav-tabs li{
    margin: 0 2px 0 0;
    position: relative;
}
.tab .nav-tabs li.active:before{
    content: "";
    position: absolute;
    bottom: -28px;
    left: 68px;
    border: 14px solid transparent;
    border-top-color: red;
}
.tab .nav-tabs li.active:after{
    content: "";
    position: absolute;
    bottom: -24px;
    left: 81px;
    border: 12px solid transparent;
    /*border-top-color: #fff;*/
}
.tab .nav-tabs li a{
    border: none;
    padding: 20px 53px;
    font-size: 14px;
    color: #777;
    background: transparent;
    border-radius: 0;
    text-decoration: none;
}
/* .tab .nav-tabs li a:hover{
    color: red;
} */
.tab .nav-tabs li a i{
    display: block;
    text-align: center;
    margin-bottom: 5px;
}
.tab .nav-tabs li.active a,
.tab .nav-tabs li.active a:focus,
.tab .nav-tabs li.active a:hover{
    border: none;
    background: transparent;
    color: red;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.20s linear 0s;
}
.tab .tab-content{
    font-size: 14px;
    color: #777;
    background: #fff;
    line-height: 25px;
    padding: 10px;
}
.tab .tab-content h3{
    font-size: 26px;
}
@media only screen and (max-width: 479px) {
    .tab .nav-tabs li a{
        padding: 10px;
    }
    .tab .nav-tabs li.active:before{
        left: 28px;
        bottom: -24px;
        border-width: 12px;
    }
    .tab .nav-tabs li.active:after{
        left: 30px;
        bottom: -20px;
        border-width: 10px;
    }
}
span.round-tabs{
 width: 15px;
 height: 15px;
 line-height: 70px;
 display: inline-block;
 border-radius: 100px;
 background: white;
 z-index: 2;
 position: absolute;
 left: 45%;
 text-align: center;
 font-size: 25px;
 top: 89%;
}

span.round-tabs.one{
 border: 2px solid #ddd;
 color: #ddd;
}

li.active span.round-tabs.one, li.active span.round-tabs.two, li.active span.round-tabs.three, li.active span.round-tabs.four, li.active span.round-tabs.five {
 background: #f8f8f8 !important;
 border: 2px solid #f8f8f8;
 color: #fff;
}

span.round-tabs.two{
 border: 2px solid #ddd;
 color: #ddd;
}

span.round-tabs.three{
 border: 2px solid #ddd;
 color: #ddd;
}

.nav-tabs > li.active > a span.round-tabs{
 background: #fafafa;
}
<div class="tab" role="tabpanel">
<!-- Nav tabs -->
  <ul class="nav nav-tabs" role="tablist">
     <li role="presentation" class="active">
      <a href="#Section1" aria-controls="home" role="tab" data-toggle="tab" id="id1">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
     <li role="presentation">
      <a href="#Section2" aria-controls="home" role="tab" data-toggle="tab" id="id2">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
     <li role="presentation">
      <a href="#Section3" aria-controls="home" role="tab" data-toggle="tab" id="id3">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
     <li role="presentation">
      <a href="#Section4" aria-controls="home" role="tab" data-toggle="tab" id="id4">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
                    
   </ul>
   <div class="tab-content">
     <div role="tabpanel" class="tab-pane fade in active" id="Section1">
      <h3>Section 1</h3>
      <p>text here</p>
     </div>
     <div role="tabpanel" class="tab-pane fade" id="Section2">
      <h3>Section 2</h3>
      <p>text here</p>
      </div>
      <div role="tabpanel" class="tab-pane fade" id="Section3">
      <h3>Section 5</h3>
      <p>text here</p>
     </div>
     <div role="tabpanel" class="tab-pane fade" id="Section4">
      <h3>Section 4</h3>
      <p>text here</p>
      </div>
    </div>
</div>

введите описание изображения здесь привет я хочу создать такое же меню, как показано в изображении. я пробовал с прикрепленным битом code.little, который я могу создать, но когда я нажимаю на другое меню, стрелка не отображается точно под меню. Показать где-нибудь еще. Как я могу реализовать тот же дизайн меню, как показано на рисунке.

1 ответ

Решение

Первый правильный z-index стрелки, т.е. установите его в 9, теперь ваша очередь jQuery Вы могли бы достичь этого click в display arrow как показано ниже,

$(document).ready(function(){
 $("ul > li").on("click",function(){
   $("ul > li").filter(".active").removeClass("active");
    $(this).addClass("active");
  });
});
a:hover,a:focus{
    text-decoration: none;
    outline: none;
}
.tab .nav-tabs{
    border-bottom: 2px solid #ddd;
}
.tab .nav-tabs li{
    margin: 0 2px 0 0;
    position: relative;
}
.tab .nav-tabs li.active:before{
    content: "";
    position: absolute;
    bottom: -28px;
    left: 68px;
    border: 14px solid transparent;
    border-top-color: red;
    z-index:9;
}
.tab .nav-tabs li.active:after{
    content: "";
    position: absolute;
    bottom: -24px;
    left: 81px;
    border: 12px solid transparent;
    /*border-top-color: #fff;*/
}
.tab .nav-tabs li a{
    border: none;
    padding: 20px 53px;
    font-size: 14px;
    color: #777;
    background: transparent;
    border-radius: 0;
    text-decoration: none;
}
/* .tab .nav-tabs li a:hover{
    color: red;
} */
.tab .nav-tabs li a i{
    display: block;
    text-align: center;
    margin-bottom: 5px;
}
.tab .nav-tabs li.active a,
.tab .nav-tabs li.active a:focus,
.tab .nav-tabs li.active a:hover{
    border: none;
    background: transparent;
    color: red;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.20s linear 0s;
}
.tab .tab-content{
    font-size: 14px;
    color: #777;
    background: #fff;
    line-height: 25px;
    padding: 10px;
}
.tab .tab-content h3{
    font-size: 26px;
}
@media only screen and (max-width: 479px) {
    .tab .nav-tabs li a{
        padding: 10px;
    }
    .tab .nav-tabs li.active:before{
        left: 28px;
        bottom: -24px;
        border-width: 12px;
    }
    .tab .nav-tabs li.active:after{
        left: 30px;
        bottom: -20px;
        border-width: 10px;
    }
}
span.round-tabs{
 width: 15px;
 height: 15px;
 line-height: 70px;
 display: inline-block;
 border-radius: 100px;
 background: white;
 z-index: 2;
 position: absolute;
 left: 45%;
 text-align: center;
 font-size: 25px;
 top: 89%;
}

span.round-tabs.one{
 border: 2px solid #ddd;
 color: #ddd;
}

li.active span.round-tabs.one, li.active span.round-tabs.two, li.active span.round-tabs.three, li.active span.round-tabs.four, li.active span.round-tabs.five {
 background: #f8f8f8 !important;
 border: 2px solid #f8f8f8;
 color: #fff;
}

span.round-tabs.two{
 border: 2px solid #ddd;
 color: #ddd;
}

span.round-tabs.three{
 border: 2px solid #ddd;
 color: #ddd;
}

.nav-tabs > li.active > a span.round-tabs{
 background: #fafafa;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="tab" role="tabpanel">
<!-- Nav tabs -->
  <ul class="nav nav-tabs" role="tablist">
     <li role="presentation" class="active">
      <a href="#Section1" aria-controls="home" role="tab" data-toggle="tab" id="id1">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
     <li role="presentation">
      <a href="#Section2" aria-controls="home" role="tab" data-toggle="tab" id="id2">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
     <li role="presentation">
      <a href="#Section3" aria-controls="home" role="tab" data-toggle="tab" id="id3">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
     <li role="presentation">
      <a href="#Section4" aria-controls="home" role="tab" data-toggle="tab" id="id4">Mission
        <span class="round-tabs one"><i class="icon icon-pencil"></i></span>
      </a>
     </li>
                    
   </ul>
   <div class="tab-content">
     <div role="tabpanel" class="tab-pane fade in active" id="Section1">
      <h3>Section 1</h3>
      <p>text here</p>
     </div>
     <div role="tabpanel" class="tab-pane fade" id="Section2">
      <h3>Section 2</h3>
      <p>text here</p>
      </div>
      <div role="tabpanel" class="tab-pane fade" id="Section3">
      <h3>Section 5</h3>
      <p>text here</p>
     </div>
     <div role="tabpanel" class="tab-pane fade" id="Section4">
      <h3>Section 4</h3>
      <p>text here</p>
      </div>
    </div>
</div>

Другие вопросы по тегам