Three divs side by side with spacing in between

前端 未结 5 938
故里飘歌
故里飘歌 2020-12-21 14:04

I\'m trying to have three of divs side by side with spacing in between the div\'s in the middle.

Here is the image of what I need:

Here is my current code:<

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-21 15:01

    You might be better using a flexbox to achieve what you need. Create a container for the three .box divs, and style it with the following:

    display:flex;
    justify-content:space-between;
    

    Keep in mind that the width of your .box divs will need to be lowered to achieve the space you want and that you would not require the float:left; in the css.

    For more info on flexboxes, click here: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

提交回复
热议问题