html - how to horizontally center a responsive div? -
trying center div contain responsive adsense code. example : <div class="wrapper"> <div class="adsense">adsense code here</div> </div> i can center div if type exact measurement of ad. 728x90 max want. @ moment have img temp placement , works fine. problem if type in exact px wont responsive. any ideas please? ok actual code... <section class="main-content"> <div class="top-banner"> <img src="img/ad_top.jpg"> </div> </section> (img there placeholder notepad++) .main-content { float: left; width: 75%; } .top-banner { margin:0 auto; } this places img left , not center. what talking about? horizontal centering done margin: 0 auto; doesn't matter size container has.