框大小不正确的HTML

问题描述

所以我要在网站上添加一个“筛选依据”。我这样做的方式是一个下拉菜单,您可以在其中选择过滤条件。筛选时,将显示正确的框。当我添加长度超过5个字符的文本时,宽度不会增加。我已经更改了width:标签,但仍然无法正常工作。 我已经从w3schools教程中复制了代码,我还不是JS方面的佼佼者,我需要用它来过滤它们。 我只想知道如何正确设置每个盒子的宽度和高度。非常感谢

<div class="container">
            <section class="u-align-center u-clearfix u-palette-5-light-2 u-section-2" 
            id="carousel_1109">
                <div class="u-clearfix u-sheet u-valign-middle u-sheet-1">
                    <div class="container">
                        <div class="filterDiv cars">Gwyn Romberg</div>
                        <div class="filterDiv colors fruits">Ute Dupuis</div>
                        <div class="filterDiv cars">Laurine Hudnall</div>
                    </div>
                <div>
            </section>
</div>
.container {
    overflow: hidden;
  }
  
  .filterDiv {
    float: left;    
    text-align: center;
    margin: 5px;
    display: none; /* Hidden by default */
    border-radius: 10px;
  }
  
  /* The "show" class is added to the filtered elements */
  .show {
    display: block;
  }
  
  /* Style the buttons */
  .btn {
    border: none;
    outline: none;
    padding: 12px 16px;
    background-color: #f1f1f1;
    cursor: pointer;
    margin: 6px;
    border-radius: 12px;
  }
  
  /* Add a light grey background on mouse-over */
  .btn:hover {
    background-color: rgb(134,136,139);
  }
  
  /* Add a dark background to the active button */
  .btn.active {
    background-color: #666;
    color: white;
  }

.container {
    width: 100%;
}

.filterDiv {
    width: auto;
    height: auto;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)