3 回答

TA貢獻(xiàn)2051條經(jīng)驗(yàn) 獲得超10個(gè)贊
.child { width: 100%; }
flex-basis: 100%
flex: 1
.parent { display: flex; flex-direction: column; width: 400px; border: 1px solid red; align-items: center;}.child { border: 1px solid blue; width: calc(100% - 2px); /* NEW; used calc to adjust for parent borders */}
<div class="parent"> <div class="child"> Lorem Ipsum is simply dummy text of the printing and typesetting industry </div> <div class="child"> Lorem Ipsum is simply dummy text of the printing and typesetting industry </div></div>
width: 100%
.

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超3個(gè)贊
width:100%
, 保持一致
.child { align-self: stretch; }
.parent { align-items: stretch; }

TA貢獻(xiàn)1850條經(jīng)驗(yàn) 獲得超11個(gè)贊
max-width: 100%;
align-self: stretch
align-items: center
width: 100%
添加回答
舉報(bào)