bootstrap 3 arrow on dropdown menu

前端 未结 4 1861
渐次进展
渐次进展 2020-12-12 12:14

In bootstrap 2 the dropdown menu had an upwards arrow as it can be seen here (i am not talking about the carret). Now using bootstrap 3 or latest git this arrow doesn\'t exi

4条回答
  •  萌比男神i
    2020-12-12 12:31

    You need to add :after and :before css rules to your dropdown-menu. These rules are taken from Bootstrap 2, and are what draw the triangle above the dropdown.

    JSFiddle DEMO

    .dropdown-menu:before {
      position: absolute;
      top: -7px;
      left: 9px;
      display: inline-block;
      border-right: 7px solid transparent;
      border-bottom: 7px solid #ccc;
      border-left: 7px solid transparent;
      border-bottom-color: rgba(0, 0, 0, 0.2);
      content: '';
    }
    
    .dropdown-menu:after {
      position: absolute;
      top: -6px;
      left: 10px;
      display: inline-block;
      border-right: 6px solid transparent;
      border-bottom: 6px solid #ffffff;
      border-left: 6px solid transparent;
      content: '';
    }
    

    Confused how? See here for an animation that explains css triangles

提交回复
热议问题