HTML/CSS set div to height of sibling

后端 未结 10 2158
南旧
南旧 2020-12-03 00:43

I have 2 div\'s contained in a third. One of the contained div\'s is floated left, the other floated right. I would like the 2 sibling div\'s to always be at the same heig

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 01:17

    I ran into this issue several times this week and this topic was the closest I came to finding a concrete answer. This is an expansion on @Pekka's response for those who need a bit more to go on, I certainly did.

    jsFiddle

    example html:

    Type
    Lorem ipsum dolor sit amet, at assum gubergren his, ex iudicabit dissentiunt intellegebat has. Ne odio detraxit instructior vim. Fugit velit consetetur an eos. Ea suas veri mnesarchum mel.

    example css:

    .view-table
    {
        display:table;
        width:100%;
    }
    .view-row
    {
        display:table-row;
    }
    .view-row > div
    {
        display: table-cell;
    
    }
    .view-name 
    {
        text-align:right;
        background-color: lightblue;
    }
    .view-type
    {
        background-color: pink;
    }
    

提交回复
热议问题