MasterACE14 Posted October 11, 2011 Share Posted October 11, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/ Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 11, 2011 Share Posted October 11, 2011 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; } Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278048 Share on other sites More sharing options...
MasterACE14 Posted October 11, 2011 Author Share Posted October 11, 2011 no change :/ Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278049 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 11, 2011 Share Posted October 11, 2011 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; } Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278050 Share on other sites More sharing options...
MasterACE14 Posted October 11, 2011 Author Share Posted October 11, 2011 That has done the trick! Thank you kindly mate. Appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278052 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 11, 2011 Share Posted October 11, 2011 No Prob Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278053 Share on other sites More sharing options...
MasterACE14 Posted October 11, 2011 Author Share Posted October 11, 2011 ah still got one problem now, it's centered but it's not at the bottom of the div anymore. Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278055 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 11, 2011 Share Posted October 11, 2011 if there is data in the feed, the feedlinks would be at the bottom. Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278067 Share on other sites More sharing options...
MasterACE14 Posted October 11, 2011 Author Share Posted October 11, 2011 ah you're right, I've missed the obvious. I've set the top margin for the feed_pagelinks to widen that gap. Looks great now, Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278080 Share on other sites More sharing options...
ZulfadlyAshBurn Posted October 11, 2011 Share Posted October 11, 2011 haha. no prob goodluck Quote Link to comment https://forums.phpfreaks.com/topic/248859-center-a-child-div-within-a-parent-div/#findComment-1278086 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.