CSS基础——img元素与同级div元素存在间隙
背景: 在练习flex布局时无意间发现img元素与同级div元素之间存在间隙,网上虽然有解决方法,但是却不知道为什么这么做,在这里记录下我的观点。 原因 代码示例: < header > < img class = " profile-thumbnail " src = " https://freecodecamp.s3.amazonaws.com/quincy-twitter-photo.jpg " alt = " Quincy Larson ' s profile picture " > < div class = " profile-name " > < h3 > Quincy Larson </ h3 > < h4 > @ossia </ h4 > </ div > < div class = " follow-btn " > < button > Follow </ button > </ div > </ header > body { font-family : Arial, sans-serif ; } header { /*display: flex;*/ background : bisque ; } header .profile-thumbnail { width : 50px ; height : 50px ; border-radius : 4px ;