change the flex spacing between div with background image

南笙酒味 提交于 2019-12-02 23:05:51

问题


hi i am remaking the google chrome home page but i cant seem to do the part at the bottom of the page were the most used apps are i am trying to do it with display flex because it puts it inline but i cant get the spacing right its uneven or to big or small here is what i want it to look like...

and here is what i get

the top one is what i need to get. notice that the spacing is to small and in the middle its to big i am looking for it to be just right justify-content doesn't seem to effect spacing? here is the css

.youtube{
background-image: url(youtube.png);


}
.facebook{
background-image: url(facebook.png);

}

.roblox{
background-image: url(roblox.png);


}

.Agar{
 background-image: url(Agar.png);


  }

    .gmail{
background-image: url(gmail.png);


 }
  .rowCell{
justify-content: space-around;
align-items: center;
position: relative;  
background-repeat: no-repeat;
width: 200px;
height: 150px;
margin-top: -589px;
left: 422px;
 }
  .mostUsedApps{
     width: 42%;
display: flex;
justify-content: space-between;
justify-content: space-around;
align-items: center;
}

here is the html

   <div class = 'mostUsedApps'>

   <div class = 'youtube rowCell'></div>

   <div class = 'facebook rowCell'   ></div>

   <div class = 'roblox rowCell'></div>


   <div class = 'Agar rowCell'></div>

   <div class = 'gmail rowCell'></div>

   </div>

Any help is much appreciated,thanks :)


回答1:


If your icons are of same size, then you would just need the justify-content property on your parent div i.e. "mostUsedApps".

If they are of different size, then you would need to provide a link to codepen or codesandbox, without that it would be difficult to help.



来源:https://stackoverflow.com/questions/54749563/change-the-flex-spacing-between-div-with-background-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!