? ?? ?? ?????: https://codepen.io/allen-houng/pen/XGMjMr?editors=1100#0
???
?? div? ? ?? ?? div(???? ??)? ????. ??? ??? ???? ??? ??? ?????. ?, ??? ???? ???? ?????. JavaScript ?? ??? ??? ?? ?? ?? div .description
? ??? ??? ??? ? ????
?, ??? ??????
??? ?????:
??? ??? 100%? ??? ??? ? ????. ??? ?? ?????? img ??? ??? "width:100%;"? ?????.
?? ??? inline-block
(或任何收縮到適合的配置,如table
、inline-grid
、inline -flex
、float
、absolute
等)然后強(qiáng)制文本寬度為 0
,從而定義容器的寬度通過(guò)圖像(文本不影響寬度),然后使用 min-width
100%