Floating ad box in the middle of an article?

Discussion in 'HTML & Website Design' started by Supergeek, Jun 11, 2007.

  1. #1
    Posted in CSS but there are 3x as many people viewing this forum...


    I've been trying to figure out how to float an ad in the middle of my articles, without having to actually put code in between article text.

    Here's a picture of a mockup for more info:

    [​IMG]

    See how the article flows around the ad box on the top and bottom? From what I'm reading about floats, I have to break it up, like

    
    Article text blah blah blah lots of stuff here....
    <div class="adbox">
    Ad Link 1
    Ad Link 2
    etc.
    </div>
    the rest of my article continues here...
    
    Code (markup):
    Is there any way to do it without sectioning the article?

    Thanks in advance.
     
    Supergeek, Jun 11, 2007 IP
    sundaybrew likes this.
  2. sundaybrew

    sundaybrew Numerati

    Messages:
    7,294
    Likes Received:
    1,260
    Best Answers:
    0
    Trophy Points:
    560
    #2
    Yes - d0 this -


    <span style="float: left; padding: 0px 15px 1px 0px">
    
    <script type="text/javascript"><!--
    google_ad_client = "";
    google_ad_width = 336;
    google_ad_height = 280;
    google_ad_format = "336x280_as";
    google_ad_type = "text";
    google_ad_channel = "";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "3300CC";
    google_color_text = "666666";
    google_color_url = "4C4C4C";
    //-->
    </script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    
    </span>
    PHP:
     
    sundaybrew, Jun 11, 2007 IP
  3. jakomo

    jakomo Well-Known Member

    Messages:
    4,262
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Great! I will look around it :)
     
    jakomo, Jun 11, 2007 IP
  4. Supergeek

    Supergeek Peon

    Messages:
    138
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    sundaybrew,

    That doesn't work. The article doesn't flow around the top of the ad box; there's an empty space there.

    Like:
    
    article............
    ...................     adbox
    ...................     adbox
    ...................     adbox
    ...................     adbox
    ..................................
    ..................................
    ..................................
    Code (markup):
     
    Supergeek, Jun 11, 2007 IP
  5. sundaybrew

    sundaybrew Numerati

    Messages:
    7,294
    Likes Received:
    1,260
    Best Answers:
    0
    Trophy Points:
    560
    #5
    sundaybrew, Jun 11, 2007 IP
  6. Supergeek

    Supergeek Peon

    Messages:
    138
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for your responses, sundaybrew.

    I can split the article with PHP and fake it ;)
     
    Supergeek, Jun 11, 2007 IP
  7. sundaybrew

    sundaybrew Numerati

    Messages:
    7,294
    Likes Received:
    1,260
    Best Answers:
    0
    Trophy Points:
    560
    #7
    Yes - That will work as well ::)
     
    sundaybrew, Jun 11, 2007 IP
  8. jakomo

    jakomo Well-Known Member

    Messages:
    4,262
    Likes Received:
    82
    Best Answers:
    0
    Trophy Points:
    138
    #8
    Great! I used the example and it is running correctly thanks a lot!
     
    jakomo, Jun 12, 2007 IP
  9. Supergeek

    Supergeek Peon

    Messages:
    138
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #9
    For those of you running WordPress that want to do the same thing as I did, you can go to this URL and download Adsense Manager for WordPress.

    This plugin allows you to manage your ads through the WordPress admin menu. For me, I added a < div > block around the ads via the "markup before" and "markup after" sections, and styled it in my style sheet with a float.

    Once that is done, all you have to do is insert < !--adsense -- > into your articles wherever you want an ad to appear.
     
    Supergeek, Jun 13, 2007 IP