question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

div at bottom of parent div

See original GitHub issue

I’m trying to get a div “float” to the bottom of the containing div.- e.g http://stackoverflow.com/questions/2147303/how-can-i-send-an-inner-div-to-the-bottom-of-its-parent-div The containing div is the element which is “matchHeighted”.

The pseudo-HTML contains:

<div class="content">
  <div class="frontpage-item">
       <div class="floatdown">
   <div class="frontpage-item">
   <div class="frontpage-item">
</div>

CSS

.frontpage-item {
    position: relative;
}
.frontpage-item .floatdown {
    bottom: 0;
    position: absolute;
}

js contains

    $(document).ready(function() {
        $(".frontpage-item").matchHeight(false);

The problem is that as soon as I “apply” position:absolute to the inner-div,- whether by css as above or later on via js/jquery (this is the actual idea), the height of the .frontpage-item div “collapses” to the height on it’s content without the inner div.

Clearly position:absolute breaks the flow - but I figured since matchHeight sets the height of the containing div explicitly this would have no effect. Somehow the flow-break bubbles up to this element afterall.

Is there any way to stop this or is there any other technique you know of to have the text of the inner-div aligned to the bottom of the outer div - without causing such a collapse? (been struggling with this for a couple of hours!)

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hubert17commented, Jan 9, 2018

Check out my solution, LAZADA inspired.

HTML:

       <div class="col-sm-4 col-lg-4 col-md-4">
                    <div class="thumbnail" data-mh="mh">
                        <a href="#">
                            <img src="" />
                        </a>
                        <div class="caption">
                            <h4 class="pull-right">$7.50</h4>
                            <h4>
                                <a href="#">Ariel</a>
                            </h4>
                        </div>
                        <div class="ratings">
                            <p class="pull-right">15 reviews</p>
                            <p>
                                <span class="glyphicon glyphicon-star"></span>
                                <span class="glyphicon glyphicon-star"></span>
                                <span class="glyphicon glyphicon-star"></span>
                                <span class="glyphicon glyphicon-star"></span>
                                <span class="glyphicon glyphicon-star"></span>
                            </p>
                        </div>
                        <div id="btn-cartpadding"></div>
                        <div class="btn-addcart">
                            <a href="#" class="btn btn-block btn-warning">ADD TO CART</a>
                        </div>
                    </div>
                </div>

CSS:


        .thumbnail > a img {
            max-height: 200px;
        }
        .thumbnail {
            border: 1px solid rgba(0, 0, 0, 0.00);
            position: relative;
        }
        .thumbnail:hover {
            border: 1px solid #dddddd;
        }
        .thumbnail:hover div.btn-addcart {
            visibility: visible;
        }
        div.btn-addcart {
            visibility: hidden;
            padding: 3px;
            width: 100%;
            position: absolute;
            bottom: 0;
            right: 0;
        }
        #btn-cartpadding {
            height: 35px;
        }
0reactions
steve-acetcommented, Jul 22, 2014

I am trying to do the same, but your trick doesn’t work for me. Any other ideas?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I send an inner <div> to the bottom of its parent <div>?
Here is way to avoid absolute divs and tables if you know parent's height: <div class="parent"> <div class="child"> <a href="#">Home</a> ...
Read more >
How to position a div at the bottom of its container using CSS?
Set the position of div at the bottom of its container can be done using bottom, and position property. Set position value to...
Read more >
Align div to the bottom of the page in 3 steps · - Omar Ghader
Step 1 : Setting the parent position to relative. If you want to align a div at the bottom of a parent div,...
Read more >
How to put elements at the bottom of its container with CSS
HTML has a parent-child relationship. To put an element at the bottom of its container with CSS, you need to use the following...
Read more >
Position Element to Bottom of Container with CSS Flex
A multi-row layout where the last DIV needs to be placed at bottom of its parent container can be created using CSS flex, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found