css 为什么我的textarea缩小,当我刷新页面,它又去正常

46scxncf  于 2023-05-23  发布在  其他
关注(0)|答案(2)|浏览(162)

为什么我打开页面时文本区域会自动缩小。

当我刷新页面时,它又恢复正常了。问题可能是

这是我的HTML代码

<div class="col-md-12 input-group pab pcomment">
        <div class="input-group-prepend">
          <span class="input-group-text">Comment</span>
        </div>
        <textarea matinput formControlName="pastMedicalHistoryComment" class="form-control" aria-label="Comment"></textarea>
    </div>

这是我的formcontrol css

.input-group>.custom-file, .input-group>.custom-select, .input-group>.form-control {
    position: relative;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    width: 1%;
    margin-bottom: 0;
}
v7pvogib

v7pvogib1#

只要给予它一些min-width:400px或一些像素,你想给默认的最小宽度。

.input-group>.custom-file, .input-group>.custom-select, .input-group>.form-control {
    position: relative;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    width: 1%;
    margin-bottom: 0;
    min-width:400px;
}
<div class="col-md-12 input-group pab pcomment">
        <div class="input-group-prepend">
          <span class="input-group-text">Comment</span>
        </div>
        <textarea matinput formControlName="pastMedicalHistoryComment" class="form-control" aria-label="Comment"></textarea>
    </div>
chy5wohz

chy5wohz2#

你基本上想要这个,但我会让你把它与BS:

div {
  display: flex; 
  align-items: center;
}
label {
  padding: 10px;
  width: max-content;
  background: #f7f7f7;
}
textarea {
  flex: 1 1 auto;
}
<div>
  <label>Comment</label>
  <textarea></textarea>
</div>

相关问题