How to change the bootstrap caret pointing position?

后端 未结 3 1226
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 12:26

Within bootstrap the caret is always pointing down. I would like it to point to the right when when the menu is closed. See demo.

Demo: http://jsfiddle.net/Maty2/

<
相关标签:
3条回答
  • 2021-01-24 12:39

    Simple:

    <span class="dropup">
        <span class="caret"></span>
    </span>
    
    0 讨论(0)
  • 2021-01-24 12:43
    1. If your element starts out collapsed, make sure to add the class explicitly

      <a class="btn dropdown-toggle fleft collapsed" data-toggle="collapse" data-target="#demo-1" href="#"><span class="caret"></span></a>
      
    2. Use this CSS

      // open state - points up
      .functionbox .caret {
        border-top-width: 0;
        border-bottom-width: 5px;
        border-bottom-style: solid;
      }
      
      // collapsed state - points down
      .functionbox .collapsed .caret {
        border-top-width: 5px;
        border-bottom-width: 0;
      }
      
    0 讨论(0)
  • 2021-01-24 12:52

    After some discussion with a friend, we came up with adding this class:

    .btn.collapsed > .caret {border-left: 4px solid #888; border-right: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent;}
    

    Though we weren't able so solve the # from being added to the end of the URL. If anyone knows of a suggestion, that would be great.

    0 讨论(0)
提交回复
热议问题