Flexboxes of equal height, content filling height of container

Murgittroyd

Link to the site I'm editing for reference: http://securitysolutionsnw.businesscatalyst.com/fire-life-safety

Here's a CodePen of the thing: http://codepen.io/Murgittroyd/pen/HqEvp

I have an unordered list of list items, and I'm trying to get each item to be the same width and height. I've started investigating and using flex-box, which helped, but I can't get the content of each box to fill the whole height of the list item. Essentially, I need boxes that are dynamically sized but by the size of the largest flexbox...anyone have any ideas?

HTML:

<ul class="box-list">
    <li>
        <div class="visual">
            <img src="/images/img07.jpg" width="281" height="187" alt="image description" />
            <div class="hover">
                <a href="/fire-life-safety/fire-extinguishers">
                    <span class="ico"><img src="/images/ico-fire-extinguishers-white-large.png" alt="image description" /></span>
                    <span class="text">Learn More</span>
                </a>
            </div>
        </div>
        <div class="content">
            <h3>
                <span class="ico"><img src="/images/ico-fire-extinguishers-white.png" alt="image description" /></span>
                <span class="text">Fire Extinguishers</span>
            </h3>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc consectetur sed sem ac facilisis. Proin venenatis nisi ut  elit a scelerisque. </p>
        </div>
    </li>
</ul>

CSS:

#content .box-list {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -14px 0 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
    color: #fff;
    font-size: 12px;
    line-height: 22px;
}
#content .box-list li {
    float: left;
    padding: 0 14px 43px 0;
    width: 281px;
}
#content .box-list li:after {
    display: none;
}
#content .box-list .content {
    overflow: hidden;
    padding: 18px 20px 33px 33px;
    background: #232a32;
}
#content .box-list .visual {
    position: relative;
    overflow: hidden;
}
Wouter Florijn

Whether or not it's possible with pure CSS depends on your exact needs. If you just need to have each row of li items the same height, then you're already doing it correct. As you can see with any Element inspection tool, the li items in a row are all the same height (in my Chrome browser at least). However, the content of your li isn't scaled to fill the full height.

If you need EVERY element on the page the same height, you probably need some JS.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Flexboxes of equal height, content filling height of container

From Dev

Equal height flexboxes with equal height children of variable content, without JS

From Java

Set min-height equal to content height

From Java

Equal height rows in a flex container

From Dev

Why does wrap_content is filling height?

From Dev

Container DIV height not adapting to content

From Dev

Container DIV height not adapting to content

From Dev

Can't get canvas element height to equal container height

From Dev

jquery set line-height equal to parent container height

From Dev

textView height equal to content size without viewDidLayoutSubviews

From Dev

Equal height columns with centered content in flexbox

From Dev

jquery div equal to window height stretches with content

From Dev

Set height of cell equal to the label content

From Dev

Set sidebar height equal with content on scroll

From Dev

Recalculate the height of a container div based on height of content within tabs

From Dev

Make container 100% height despite no content

From Dev

Container full rest height with scrollable content (Tailwind)

From Dev

Auto adjust the height of container based on content

From Dev

container height is less than its content

From Dev

Filling height using css

From Dev

Set height equal to browser height

From Dev

UITableView height equal to contentSize height

From Dev

Make two divs inside container equal height (100%)

From Dev

Twitter Bootstrap equal height columns and content aligned bottom

From Dev

How to set a height of the panel equal to the content in jquery mobile?

From Dev

Issue with hover not filling height of navbar

From Dev

Custom Actionbar View - not filling height

From Dev

Issue with hover not filling height of navbar

From Dev

JQuery Equal Height Rows

Related Related

  1. 1

    Flexboxes of equal height, content filling height of container

  2. 2

    Equal height flexboxes with equal height children of variable content, without JS

  3. 3

    Set min-height equal to content height

  4. 4

    Equal height rows in a flex container

  5. 5

    Why does wrap_content is filling height?

  6. 6

    Container DIV height not adapting to content

  7. 7

    Container DIV height not adapting to content

  8. 8

    Can't get canvas element height to equal container height

  9. 9

    jquery set line-height equal to parent container height

  10. 10

    textView height equal to content size without viewDidLayoutSubviews

  11. 11

    Equal height columns with centered content in flexbox

  12. 12

    jquery div equal to window height stretches with content

  13. 13

    Set height of cell equal to the label content

  14. 14

    Set sidebar height equal with content on scroll

  15. 15

    Recalculate the height of a container div based on height of content within tabs

  16. 16

    Make container 100% height despite no content

  17. 17

    Container full rest height with scrollable content (Tailwind)

  18. 18

    Auto adjust the height of container based on content

  19. 19

    container height is less than its content

  20. 20

    Filling height using css

  21. 21

    Set height equal to browser height

  22. 22

    UITableView height equal to contentSize height

  23. 23

    Make two divs inside container equal height (100%)

  24. 24

    Twitter Bootstrap equal height columns and content aligned bottom

  25. 25

    How to set a height of the panel equal to the content in jquery mobile?

  26. 26

    Issue with hover not filling height of navbar

  27. 27

    Custom Actionbar View - not filling height

  28. 28

    Issue with hover not filling height of navbar

  29. 29

    JQuery Equal Height Rows

HotTag

Archive