Question

I have a logo in the header of my wordpress site and I would like to add an adsense banner next to it like this : adsense banner header

For my logo, I have a div logo and this css code :

#logo { float: left; margin-top: 60px; }

I know I need to create a new div for my adsense code but what css code should I use so the adsense banner appear to the right just next to the logo ?

I need to make sure that both div will never be superimposed (on all devices).

Was it helpful?

Solution

This should work:

HTML:

<div id="logo">
Some code here for the logo
</div>

<div id="ad-banner"> 
    Ad banner goes here                 
</div>

<div style="clear:both;">&nbsp;</div>

CSS:

#ad-banner 
{ 
    float: right; 
    margin-top: 60px; 
}

Putting the HTML in the header-middle div and the #ad-banner style into the style.css file. It should work.

OTHER TIPS

  1. Open WordPress Editor
  2. Open the header.php file
  3. In this file – look for the following code

<header id=”masthead” role=”banner”>

  1. Make the following change to the hgroup tag by adding style=”display:inline-block”

  2. Immediately below the hgroup tag, add the Ad (Google AdSense) Code inside a span block as shown below:

<span style=”float:right”>
<!– Paste Ad Sense Code below–>
</span>

  1. Save the file

Source: http://techzog.com/wordpress/how-to-add-banner-ad-to-wordpress/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top