Difference between background-size:cover and background-size:contain

前端 未结 6 622
孤独总比滥情好
孤独总比滥情好 2020-12-08 02:38

Visually I can appreciate the difference, but in which situations should I prefer one over the other? Is there any point using them at all or can they be replaced by percent

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 03:32

    We had a huge conversation about cover vs contain just want to share this thoughts:

    1. landscape image on landscape screen - best to use cover
    2. portrait image on landscape screen - best to use contain

    3. portrait image on landscape screen - best to use contain

    4. portrait image on landscape screen - best to use contain

    Illustration:

    if(iDonPutSomeCode) const result = iCantPasteLinkToCodePen
    

    https://codepen.io/Kinosura/pen/EGZbdy?editors=1100

提交回复
热议问题