Jump to content

center a child div within a parent div


MasterACE14

Recommended Posts

I'm trying to center the 'feed_pagelinks' div at the bottom of the 'feed' div. I've got it at the bottom, but it's in the far left corner, I wish to center it and aren't having much luck. Any help is appreciated, thanks!

 

div#feed {
    border: 2px solid #555;
    padding: 4px;
    margin-bottom: 20px;
    text-align: center;
    display: block;
    min-height: 100px;
    position: relative;
}

div#feed_pagelinks {
    margin: auto;
    margin-top: 15px;
    position:absolute;
    bottom: 0;
    margin-bottom: 5px;
}

 

<div id="feed">
{{update_feed}}

{{feed}}

<div id="feed_pagelinks">| {{page_links}} |</div>
</div>

Link to comment
Share on other sites

try this.

div#feed {
    border: 2px solid #555;
    padding: 4px;
    margin-bottom: 20px;
    text-align: center;
    display: block;
    min-height: 100px;
    position: relative;
}

div#feed_pagelinks {
    margin:0 auto;
    margin-top: 15px;
    position:absolute;
    bottom: 0;
    margin-bottom: 5px;
}

Link to comment
Share on other sites

use this instead. i changed the position from absolute to relative for div#feed_pagelinks

 

<style>
div#feed {
    border: 2px solid #555;
    padding: 4px;
    margin-bottom: 20px;
    text-align: center;
    display: block;
    min-height: 100px;
    position: relative;
}

div#feed_pagelinks {
    margin: auto;
    margin-top: 15px;
    position:relative;
    bottom: 0;
    margin-bottom: 5px;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.