2

如何在活动选项卡下添加箭头形状?

.nav-tabs2 .active { background-image:url(http://www.asiarooms.com/assets/themes/v1/images/areas/details/menu-arrow.png); background-repeat:no-repeat; background-position:bottom center; }

http://jsfiddle.net/DJHZb/13/

<div class="box-head tabs">
  <ul class="nav2 nav-tabs2">
   <li class="active">
    <a href="#0" data-toggle="tab" class="firstelement">Active Tab</a></li>
   <li><a href="#1" data-toggle="tab">Inactive Tab</a></li>
   <li><a href="#2" data-toggle="tab">Inactive Tab #2</a></li>
  </ul>
</div>
4

3 回答 3

9

Take a look at "css speech bubble" the idea is the same: http://nicolasgallagher.com/pure-css-speech-bubbles/demo

You have to mess with pseudo css ::after and ::before (which doesn't work in some IE), and borders to create a square or an triangle that overlapping each other.

Example:

.active::after {
content: "";
position: absolute;
bottom: -15px;
left: 50px;
border-width: 15px 15px 0;
border-style: solid;
border-color: #F3961C transparent;
display: block;
width: 0;
}

Here is an explanation how to create triangle with a box and border: http://www.sitepoint.com/pure-css3-speech-bubbles/

于 2013-01-12T15:16:12.427 回答
1

对于这样的代码(使用引导程序):

<body>
  <div class="panel panel-primary">
    <div class="panel-heading" style="font-size:large">
       Klujo
    </div>

    <div class="panel-body">
        <div class="wizard">
            <a >
                Step 1<br>
        Authorize the app
            </a>
            <a class="active">
                Step 2<br>
        Post your jobs
            </a>

        </div>
   </div>

  </div>
</body>

你可以像这样使用css:

.wizard a {
    background: #efefef;
    display: inline-block;
    margin-right: 5px;
    min-width: 150px;
    outline: none;
    padding: 10px 40px 10px;
    position: relative;
    text-decoration: none;
}

.wizard .active {
    background: #007ACC;
    color: #fff;
}

.wizard a:before {
    width: 0;
    height: 0;
    border-top: 25px inset transparent;
    border-bottom: 35px inset transparent;
    border-left: 20px solid #fff;
    position: absolute;
    content: "";
    top: 0;
    left: 0;
}

.wizard a:after {
    width: 0;
    height: 0;
    border-top: 35px inset transparent;
    border-bottom: 25px inset transparent;
    border-left: 21px solid #efefef;
    position: absolute;
    content: "";
    top: 0;
    right: -20px;
    z-index: 2;
}

.wizard a:first-child:before,
.wizard a:last-child:after {
    border: none;
}

.wizard a.active:after {
    border-left: 21px solid #007ACC;
}

得到想要的结果

于 2015-06-03T10:10:42.820 回答
0
  </body>   
  <style>   
    .tool {
     position: relative;
     display: inline-block;
     border-bottom: 1px dotted red;
     }

   .tool .text {
    visibility: hidden;
    width: 100%;
    background-color: blue;
    color: white;
    text-align: center;
    border-radius: 5px;
    padding: 5px 0;
    position: absolute;

    top: -1px;
     left: 110%;
     }

    .tool .text::after {
     content: "";
      position: absolute;
      top: 10%;
      right: 99%;
       margin-top: -2px;
      border-width: 5px;
      border-style: solid;
      border-color: transparent blue transparent transparent;
      }
     .tool:hover .text {
     visibility: visible;
       }
     </style>   

     <div class="tool">Mouse Hover
      <span class="text">I Can pop up on the right side of these   words</div>
      </body>
于 2017-02-12T18:49:23.417 回答