homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Center Adsense in Wordpress theme
brnm98105




msg:4253715
 6:39 pm on Jan 15, 2011 (gmt 0)

Hi all I have a theme that Im trying to center a google adsense leaderboard in. It was built for navigation but Ive just placed my Adsense code there and its all to the left. I want it in the center Any help please?

Here is the CSS

#sec-nav {
width:1000px;
display:block;
float:left;
background:#fff;
border-bottom:1px solid #fff;
height:28px;
padding:0;
}

#sec-nav ul {
list-style:none;
color:#000;
font-family:Helvetica Neue,Helvetica,Arial,FreeSans,sans-serif;
height:28px;
}

#sec-nav li {
padding:6px 4px 2px 4px;
float:left;
list-style:none;
margin:0;
}

#sec-nav li a {
text-decoration:none;
text-transform:uppercase;
font-size:12px;
font-weight:700;
color:#000000;
margin:1px 0 0 18px;
}

#sec-nav li a:hover {
color:#B00000;
}

there is no navigation in this area id like to just place my adsense code there and center it within page.

Here is the Header.php Code

<?php $td_sec_menu_check = get_option('td_sec_menu_check'); if($td_sec_menu_check): ?>
<div id="sec-nav">
<ul>
<li>
<?php $td_sec_menu_code = get_option('td_sec_menu_code'); echo stripslashes($td_sec_menu_code); ?>
</li>
</ul>
</div>



Any ideas?

Thanks in advance

 

SuzyUK




msg:4255061
 10:24 am on Jan 19, 2011 (gmt 0)

there's some unnecessary CSS in your sample but in the interest of not fickering with your theme, I think the best thing is for you to insert a <div> with a class so you can isolate/CSS just that div.. then center it as required.. e.g.



#sec-nav .asen {
background: #cfc;
width: 500px; /* same as or slightly wider than the adsense leaderboard */
margin: 0 auto; /* will center if a width is given */
}


<div id="sec-nav">
<ul>
<li>
<div class="asen">Adsense code in here</div>
</li>
</ul>
</div>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved