UnknownPlayer Posted February 21, 2011 Share Posted February 21, 2011 Can someone help me with this div: .fb { color: #333; width: 600px; padding: 5px; background-color: #f7f7f7; border: 1px solid #b7b7b7; } That div is main div, but it is not centered, can someone tell me what should i add to make it on center? btw in attachment is compressed template.. Thanks. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/228436-help-center-div/ Share on other sites More sharing options...
cssfreakie Posted February 21, 2011 Share Posted February 21, 2011 I would use an ID for that div really instead of a class. anyways this is what you can do div#my-centered-div{ margin:0 auto; width:960px; /*just some width */ } for IE6 and lower use div#my-centered-div{ text-align:center; } Hope this helps Link to comment https://forums.phpfreaks.com/topic/228436-help-center-div/#findComment-1177910 Share on other sites More sharing options...
UnknownPlayer Posted February 22, 2011 Author Share Posted February 22, 2011 And before <div id="fb"> to put <div id="my-centered-div"> ? Link to comment https://forums.phpfreaks.com/topic/228436-help-center-div/#findComment-1177988 Share on other sites More sharing options...
cssfreakie Posted February 22, 2011 Share Posted February 22, 2011 And before <div id="fb"> to put <div id="my-centered-div"> ? no read that last sentence, i have a lot of difficulty deciphering that. Anyways, since i have no clue what your last question is. Most websites have a markup like this and what they do is center the wrapper div. So in other words They wrap up all they want in 1 div (in this case named wrapper) and apply the margin:0 auto; to it. <body> <div id=wrapper> <div id=header></div> <div id=left></div> <div id=mid></div> <div id=right></div> <div id=footer></div> </div> </body> if you have questions let me know Link to comment https://forums.phpfreaks.com/topic/228436-help-center-div/#findComment-1177993 Share on other sites More sharing options...
UnknownPlayer Posted February 22, 2011 Author Share Posted February 22, 2011 I putted this my-centered-div, and it works fine Link to comment https://forums.phpfreaks.com/topic/228436-help-center-div/#findComment-1178156 Share on other sites More sharing options...
cssfreakie Posted February 22, 2011 Share Posted February 22, 2011 I putted this my-centered-div, and it works fine nice one, mark it solved, saves others time reading Link to comment https://forums.phpfreaks.com/topic/228436-help-center-div/#findComment-1178292 Share on other sites More sharing options...
UnknownPlayer Posted February 22, 2011 Author Share Posted February 22, 2011 But 1 more thing, can u tell me why u said to dont use class ? :S And how to do that, to make .fb into id ? Link to comment https://forums.phpfreaks.com/topic/228436-help-center-div/#findComment-1178315 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.