我相信通過將flex框的子元素設置為flex: 1;,您將獲得更接近預期的結果。我還從輸入中刪除了display: flex;。 因此,我可以用下面的方法得到更好的結果。 .comment { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: center; background-color: white; flex-wrap: wrap; flex-direction: row; border: 1px solid #efefef; } .com-row { width: 100%; min-height: 50px; flex-wrap: wrap; display: flex; flex-direction: row; align-items: center; justify-content: flex-start; } .txt { width: 550px; min-height: 50px; margin: 0 5px; background-color: red; flex: 1; align-items: center; justify-content: center; flex-direction: row; flex-wrap: wrap; border: none; } .com-row h4 { flex: 1; }
我相信通過將flex框的子元素設置為
flex: 1;
,您將獲得更接近預期的結果。我還從輸入中刪除了display: flex;
。因此,我可以用下面的方法得到更好的結果。