jasonc Posted June 22, 2011 Share Posted June 22, 2011 basically i would like the messageDiv to be in the center of the results div but leaving the results div alone as it is floated to the left. .results { border-top: 1px solid #F0F0F0; border-left: 1px solid #E5E5E5; border-right: 1px solid #E5E5E5; float: left; width: 695px; margin-left: 5px; padding: 3px; font-size: 9pt; } .messageDiv { width: 500px; border-radius:15px; border: 1px solid #A5260F; background: #E28B65; margin: 5px 0 5px 0; text-align: center; } <div class="results"> <div class="messageDiv"><?=$message;?></div> </div> Link to comment https://forums.phpfreaks.com/topic/240122-center-a-div-and-its-content-but-not-center-content-of-its-parent-div/ Share on other sites More sharing options...
cssfreakie Posted June 22, 2011 Share Posted June 22, 2011 change your code to this .messageDiv { margin:5px auto; /* instead of 0 i set it to auto */ width: 500px; border-radius:15px; border: 1px solid #A5260F; background: #E28B65; text-align: center; } if this solved it for you (which i know it does ) please mark it solved, same is for your other questions, or at least be as polite as to respond. We are not responding to trees here. http://www.phpfreaks.com/forums/index.php?topic=336354.0 http://www.phpfreaks.com/forums/index.php?topic=336773.0 http://www.phpfreaks.com/forums/index.php?topic=336656.0 http://www.phpfreaks.com/forums/index.php?topic=336429.0 Link to comment https://forums.phpfreaks.com/topic/240122-center-a-div-and-its-content-but-not-center-content-of-its-parent-div/#findComment-1233392 Share on other sites More sharing options...
jasonc Posted June 22, 2011 Author Share Posted June 22, 2011 that did the trick, thank you Link to comment https://forums.phpfreaks.com/topic/240122-center-a-div-and-its-content-but-not-center-content-of-its-parent-div/#findComment-1233542 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.