创建下拉按钮水平

时间:2018-05-14 21:06:08

标签: html css html5 twitter-bootstrap css3

我想在bootstrap中创建一个简单的两个下拉按钮,

到目前为止,我所做的就是:

label{
    font-size: 0.875rem;
    color: #666666;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: .5rem;
    display: block;
    display: flex;
    position: absolute;
}

.dropdown-select{

    width: 500px;
    border-bottom-color: deepskyblue;
    background-color: white;
    border-top: 0px;
    border-left: 0px;
    border-right: 0px;
        margin-right: 30px;
}

.dropdown-list{

    margin-top: 50px;
}

.btn-group>.btn-group:not(:first-child)>.btn, .btn-group>.btn:not(:first-child)
{
    border: none;
    color: green;
    background-color: white;
    margin-left: -22px;
    position: absolute;
    left: 532px
}
<div class="container>

<div class="row">


        <div class="btn-group dropdown-list">

        <label class="label-status">Test1</label>
            <button class="dropdown-select" type="button"
                    aria-haspopup="true" aria-expanded="false" data-toggle="dropdown">
               <input type="hidden" > demo
            </button>
            <button [disabled]="disabled" type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split"
                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <span class="sr-only">Toggle Dropdown</span>
            </button>
            <div class="dropdown-menu">
             <button class="dropdown-item" type="button">Action</button>
            </div>

            <label class="label-serv">Test1</label>
            <button class="dropdown-select" type="button"
                    aria-haspopup="true" aria-expanded="false" data-toggle="dropdown">
               <input type="hidden" > demo
            </button>
            <button [disabled]="disabled" type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split"
                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <span class="sr-only">Toggle Dropdown</span>
            </button>
            <div class="dropdown-menu">
             <button class="dropdown-item" type="button">Action</button>
            </div>



        </div>

</div>

上面的代码给我这样的东西: wrong view

我尝试了不同的方式,我无法理解,

实际结果应如下所示: actual view

任何类似的例子,教程或帮助将不胜感激。

由于

1 个答案:

答案 0 :(得分:0)

这是我的例子,也许你可以使用其中的一些部分。 我在您的&#34;实际视图&#34;

中准备了设计

&#13;
&#13;
.content{
  margin: 0;
  width: 100%;
}
span{
  font-size: 14px;
  color: #ccc;
}
.dropbtn {
    color: #333;
    padding: 5px 5px 5px 0px;
    font-size: 16px;
    cursor: pointer;
}
.dropbtn span{
  color: #62c2ea;
  float: right;
  transform: rotate(-90deg);
}
.dropdown {
    position: relative;
    display: inline-block;
    border-bottom: 2px solid #62c2ea;
    width: 40%;
    margin-right: 30px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    width: 100%;
    margin-top: 2px;
}

.dropdown-content a {
    color: black;
    padding: 16px 16px;
    text-decoration: none;
    display: block;
}

.dropdown-content a:hover {background-color: #f1f1f1}

.dropdown:hover .dropdown-content {
    display: block;
}
&#13;
<div class="content">
  <div class="dropdown">
    <span>Specjalista</span>
    <div class="dropbtn">Dropdown 1 <span>&#10094;</span></div>
    <div class="dropdown-content">
      <a href="#">Link 1</a>
      <a href="#">Link 2</a>
      <a href="#">Link 3</a>
    </div>
  </div>
  <div class="dropdown">
  <span>Status</span>
    <div class="dropbtn">Dropdown 2 <span>&#10094;</span></div>
    <div class="dropdown-content">
      <a href="#">Link 4</a>
      <a href="#">Link 5</a>
      <a href="#">Link 6</a>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;