How set the same height of divs

前端 未结 5 2022
面向向阳花
面向向阳花 2021-01-14 19:59

This is my situation

HTML

 
相关标签:
5条回答
  • 2021-01-14 20:17

    You can use display:table-cell property for this. and remove float:left write like this:

    #item1, #item2
    {
        display:table-cell;
    }
    

    Check this http://jsfiddle.net/59qEt/5/

    Note it's work till IE8 & above.

    0 讨论(0)
  • 2021-01-14 20:23

    remove the item2 from css `

    <div id="item1">
        <div class="empty">&nbsp;</div>
        <div class="empty">&nbsp;</div>
        <div class="empty">&nbsp;</div>
    </div>
    <div id="item1">
        <div class="empty">&nbsp;</div>
    </div>
    

    `

    0 讨论(0)
  • 2021-01-14 20:26

    in item 1 you are using 3 div each div with padding:10px; and in item 2 just 1 div you can do 2 thing 1 in item 2 add 3 div and option 2. apply height on item 2 and item 2 child empty

    0 讨论(0)
  • 2021-01-14 20:32

    You can try something like this:

    #item2 > div {
        padding-bottom:200px;
    }
    

    Here's the fiddle for this :

    http://jsfiddle.net/59qEt/24/

    0 讨论(0)
  • 2021-01-14 20:43

    Just add two string of JavaScript http://jsfiddle.net/59qEt/20/ Works in all browsers

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