Как установить ширину sub div полной ширины sroll div? - PullRequest
1 голос
/ 30 марта 2020

Это мой код: я хочу установить ширину полного родительского элемента groupItemSearch:

<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 Ответ

1 голос
/ 30 марта 2020

Я исправил проблему для вас, дайте мне знать. Элементы управления (текстовое поле, кнопка) заставляли 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>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...