代码之家  ›  专栏  ›  技术社区  ›  D T

如何设置sub div的宽度sroll div的全宽?

  •  0
  • D T  · 技术社区  · 6 年前

    这是我的密码:

    <html >
    <head>    
    <style>
    .searchframe {
        border: 1px solid #545454;
        min-height: 80vh;    
        overflow-y: scroll;
        width: 290px;   
       
    }
    .btnMenu {
        width: 100%;
        display: block;
        background: #2185D0;   
        white-space: nowrap;
       
    } 
    .groupItemSearch{
        padding-bottom:10px;
        width:100%;
    }
    .groupLeft {   
        white-space: nowrap;
    }
    </style>	
    </head>
    <body>
        <div class="searchframe">
    	  <div class="groupItemSearch">
    		  <a style="Color:#ffffff;"  class="btnMenu" >External Static pressure - inchAqua</a>
    		  <div class="groupLeft">
    		  <input type="text" style="display: inline;">
    		  <label style="display: inline;">~</label>
    		  <input style="display: inline;">
    		  <label style="display: inline;"> inchAqua</label>
    		  <button style="display: inline;">Search </button>
    		  </div>
    	  </div>
          <div class="groupItemSearch">
    		  <a style="Color:#ffffff;"  class="btnMenu" >External Static pressure - inchAqua</a>
    		  <div class="groupLeft">
    		  <input type="text" style="display: inline;">
    		  <label style="display: inline;">~</label>
    		  <input style="display: inline;">
    		  <label style="display: inline;"> inchAqua</label>
    		  <button style="display: inline;">Search </button>
    		  </div>
    	  </div>
    	</div>
    </body>
    </html>

    如何设置sub div的宽度sroll div的全宽?

    1 回复  |  直到 6 年前
        1
  •  1
  •   Manjuboyz    6 年前

    我已经为你解决了这个问题,让我知道。控件(文本框、按钮)使 width 290px 根据您的要求,您需要在同一宽度内。

    .searchframe {
      height: 80vh;
      border: 2px solid yellow;
      white-space: nowrap;
      width: 290px;
      overflow: auto;
    }
    
    .btnMenu {
      color: #ffffff;
      background: #2185D0;
    }
    
    .groupItemSearch {
      padding-bottom: 10px;
      border: 1px solid red;
      display: inline-block;
    }
    <body>
      <div class="searchframe">
        <div class="groupItemSearch">
          <a class="btnMenu">External Static pressure - inchAqua</a>
          <div class="groupLeft">
            <input type="text">
            <label>~</label>
            <input>
            <label> inchAqua</label>
            <button>Search </button>
          </div>
        </div>
      </div>
    </body>

    .searchframe {
      height: 80vh;
      border: 2px solid yellow;
      white-space: nowrap;
      width: 290px;
      overflow: auto;
      display: flex;
      flex-direction: column;
    }
    
    .btnMenu {
      color: #ffffff;
      background: #2185D0;
    }
    
    .groupItemSearch {
      padding-bottom: 10px;
      display: inline-block;
    }
    <html>
    <head>
    </head>
    <body>
      <div class="searchframe">
        <div class="groupItemSearch"> <a class="btnMenu">External Static pressure - inchAqua</a>
          <div class="groupLeft">
            <input type="text">
            <label>~</label>
            <input>
            <label> inchAqua</label>
            <button>Search </button>
          </div>
        </div>
    
        <div class="groupItemSearch"> <a class="btnMenu">External Static pressure - inchAqua</a>
    
          <div class="groupLeft">
            <input type="text">
            <label>~</label>
            <input>
            <label> inchAqua</label>
            <button>Search </button>
          </div>
        </div>
    
    
        <div class="groupItemSearch"> <a class="btnMenu">External Static pressure - inchAqua</a>
    
          <div class="groupLeft">
            <input type="text">
            <label>~</label>
            <input>
            <label> inchAqua</label>
            <button>Search </button>
          </div>
        </div>
    
      </div>
    
    </body>
    
    </html>