Fluid width with equally spaced DIVs

前端 未结 7 1736
耶瑟儿~
耶瑟儿~ 2020-11-22 01:21

I have a fluid width container DIV.

Within this I have 4 DIVs all 300px x 250px...

7条回答
  •  礼貌的吻别
    2020-11-22 01:58

    This worked for me with 5 images in diferent sizes.

    1. Create a container div
    2. An Unordered list for the images
    3. On css the unordened must be displayed vertically and without bullets
    4. Justify content of container div

    This works because of justify-content:space-between, and it's on a list, displayed horizontally.

    On CSS

     #container {
                display: flex;
                justify-content: space-between;
     }
        #container ul li{ display:inline; list-style-type:none;
    }
    

    On html

提交回复
热议问题