Twitter Bootstrap sideways caret

前端 未结 9 564
执念已碎
执念已碎 2021-01-31 03:09

I\'m using Twitter Bootstrap and some custom css (found here) to have dropdown menus open up on mouseover.

I am using the \"caret\" on a on the root menu items to show

相关标签:
9条回答
  • As user2661940 said you can use glyphicons for Bootstrap 3 or you can also make your own class for every side. For example

    .caret-right {
      display: inline-block;
      width: 0;
      height: 0;
      margin-left: 2px;
      vertical-align: middle;
      border-left: 4px solid;
      border-bottom: 4px solid transparent;
      border-top: 4px solid transparent;
    }
    
    0 讨论(0)
  • 2021-01-31 03:21

    I added a rotation class to the span

    HTML:

    <span class="rotate270 caret"></span>
    

    CSS:

    .rotate270 {
        -webkit-transform: rotate(-90deg);
        -moz-transform: rotate(-90deg);
        -o-transform: rotate(-90deg);
        -ms-transform: rotate(-90deg);
        transform: rotate(-90deg);
    }
    

    You can obviously create other angle classes as desired.

    0 讨论(0)
  • 2021-01-31 03:25

    Use the bootstrap (3.0) Glyphicons

    <span class="glyphicon glyphicon-chevron-up"></span> <!-- UP -->
    <span class="glyphicon glyphicon-chevron-down"></span> <!-- DOWN-->
    
    0 讨论(0)
  • 2021-01-31 03:29

    you can use simple code:

    HTML

    <span class="caret"></span>
    

    CSS:

    .caret{
    border-color:#ffffff transparent transparent transparent;
    border-width:4px;
    border-style:solid;
    content: ""
    display:inline-block;
    }
    
    0 讨论(0)
  • 2021-01-31 03:33

    I use these styles to do that (it works without bootstrap as well)

    HTML:

    <span class="caret up"></span>
    <span class="caret right"></span>
    <span class="caret down"></span>
    <span class="caret left"></span>
    

    CSS:

    .caret {
        border: 5px solid transparent;
        display: inline-block;
        width: 0;
        height: 0;
        opacity: 0.5;
        vertical-align: top;
    }
    .caret.up {
        border-bottom: 5px solid;
    }
    .caret.right {
        border-left: 5px solid;
    }
    .caret.down {
        border-top: 5px solid;
    }
    .caret.left {
        border-right: 5px solid;
    }
    
    0 讨论(0)
  • 2021-01-31 03:35

    Just add the css to rotate the caret on mouse hover

    .navbar-nav>li>.dropdown-menu{
        display:block;
        visibility:hidden;
    
    }
    .navbar-nav>li:hover>.dropdown-menu{
        visibility:visible;
    }
    .navbar-default .navbar-nav>li:hover>a .caret{
        transform:rotate(-90deg);
        transition:all 0.3s ease-in-out;
    }
    
    0 讨论(0)
提交回复
热议问题