blogsmith Posted October 24, 2007 Share Posted October 24, 2007 I tried to center a Google AdSense search box atTest Centering Searchboxsurrounding the script with <div style="text-align:center;">script></div>and <span style="text-align:center;">script></spanv>plus even the deprecated <center>script</center>All failed. I remember being able to center the seach box with <center>script</center> before, but now even that don't work.Can anybody help?Thanks Link to comment Share on other sites More sharing options...
Skemcin Posted October 24, 2007 Share Posted October 24, 2007 <div style="text-align:center;">[google script]</div>or<div align="center">[google script]</div>You could add a width too or even this (replace your banner width below accordingly:<div style="margin:0px auto; width:468;">[google script]</div> Link to comment Share on other sites More sharing options...
blogsmith Posted October 25, 2007 Author Share Posted October 25, 2007 <div style="text-align:center;">[google script]</div>and <span style="text-align:center;">[google script]</span>works in IE6 but not Firefox 2.0<center>works in both but I am sure you guys will discourage thisWill test your additional suggestion later.Thanks Link to comment Share on other sites More sharing options...
jlhaslip Posted October 25, 2007 Share Posted October 25, 2007 The Cascade of Styling gives id's more 'weight' than classes, so try adding an id= to the element which you need to target. And a class will simply add to the strength of the selector. <div id="google_ads_id" class="centered" >[google script]</div>div#google_ads_id .centered { margin:0 auto; text-align:center; } Look here: http://www.w3.org/TR/CSS21/cascade.html#cascadeespecially at 6.4.3 Calculating a selector's specificity Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.