Align divs horizontally

前端 未结 3 788
臣服心动
臣服心动 2021-01-20 01:46

I have the following Divs:

   
\"notch\"/
相关标签:
3条回答
  • 2021-01-20 02:20

    Apply a float:left on .custimage

    .custimage{
       position:relative;
       margin-top: 15px;
       margin-left: 15px;
       height: 170px;
       width: 130px;
       background-color: #999;
       text-align:left;
       float: left;  // float all cust images to the left so they stack up against each other
    }
    
    0 讨论(0)
  • 2021-01-20 02:24

    Add float: left to .custimage .

    0 讨论(0)
  • 2021-01-20 02:25

    two ways:

    first: add float:left to your .custimage

    second: instead of float, add display:inline-block to your .custimage.

    The second one does not work in older Browsers, but is way more cleaner than let all float around.

    0 讨论(0)
提交回复
热议问题