Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Positioning a Google Ad with HTML

    Edited by <!profile=WyllyWylly>WyllyWylly<!/profile> to clarify subject line (previously "HTML") so people would know what the thread was about

    Hi,

    I want to put a Google ad in the top right corner of my home page.

    I'm attaching the HTML in a .TXT file, because the Lounge won't allow me to post it here.

    The problem is, I can't figure out how to position the ad, using simple HTML, on the same line as the Jonathan Rick pic.

    Any ideas? Thanks a lot!
    Attached Files Attached Files

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Positioning a Google Ad with HTM

    I'm not sure what you mean by "on the same line." If you want to preserve the centering of the title graphic, one technique is to position the script output on a higher "layer." Layers can be created by positioning a <div>. In this example it is positioned in the upper right corner and appears in front of the <hr> element because it's taller than your graphic:
    <pre><body>
    <h1></h1>
    <div style="position:absolute; top:0; right:0; z-index:5;">
    <script type="text/javascript">< !--
    google_ad_client = "pub-7519498235345427";
    google_ad_width = 125;
    google_ad_height = 125;
    google_ad_format = "125x125_as";
    google_ad_type = "text";
    google_ad_channel ="";
    google_color_border = "336699";
    google_color_bg = "FFFFFF";
    google_color_link = "0000FF";
    google_color_url = "008000";
    google_color_text = "000000";
    //-- > </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>
    <hr></pre>

    Do you like the effect? (Note: the comment tags were broken for Lounge posting.)

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    Cincinnati, Ohio, USA
    Posts
    7,089
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Positioning a Google Ad with HTML

    You could put the header into a single row table with three cells: left, center and right justified. It's more fashionable these days to use CSS floating.

    Put <code>.floatright { float: right; }</code> into your style section. Then enclose your attached html with a <code><DIV></code> as in:
    <pre><div class="floatright">
    <script type="text/javascript"></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>

    <h1></h1>
    </pre>


    I added two line breaks to put the horizontal row below the image.
    Attached Files Attached Files
    -Mark

  4. #4
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Jscher2000 and Mark,

    Thank you both for your prompt replies. I went with Mark's, simply because the ad didn't display using jscher2000's HTML. (Thanks also for making the subject line more descriptive.)

    In any event, I have another request, as usual.

    As you can see from some browsing, I've embedded the Jonathan Rick pic in each Web page. I am now ready to move on from this cumbersome process and use instead what I assume would be frames.

    Going from memory, I should do the following, right?
    1. Create a new Web page, say index2.htm, with the pic, the Google ad and the <hr>.

    2. Remove the pic and <hr> from each page and in its place create a link to index2.htm.

    I greatly appreciate your help!

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Jon

    Personal opinion here. Keep away from frames as much as possible if you can. From my experience they are a pain to control. As you have quite rightly noted different browsers view styles in different ways. What you have done is not wrong. I have have a habit of creating an index page to how I want the look and feel of my site to look and then save that as my template for subsequesnt lower level pages. This would include my body, my banner section (here your Jon Rick pic and link), my primary nav bar, my secondary nav bar and my footer. After I am happy with that I know I can rename my template to subsequent pages and then all my set is identical.

    To frame or not to frame

    Anyway my <img src=/S/2cents.gif border=0 alt=2cents width=15 height=15> worth
    Jerry

  6. #6
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    Cincinnati, Ohio, USA
    Posts
    7,089
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Positioning a Google Ad with HTML

    I agree with Jezza - avoid frames unless you have a burning need for them. Visitors hate them and they are a pain to work with providing little benefit.

    What you can do to get around this is to use Server Side Includes (SSI's) - for example, my personal site uses them extensively. All HTML at http://www.broge.com after the body tag is included in three SSI's: the header section, the actual page content, and then the footer. In this way I can make a few small edits and they nicely cascade out to all the pages that use that particular code snippet.

    I've attached a sample page from my site so that you can see how it's integrated. If you were to view source on the live page, it would look vastly different because the code is rendered in real-time by the includes. Take a look and see what you think.
    Attached Files Attached Files
    -Mark

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Positioning a Google Ad with HTML

    > the ad didn't display using jscher2000's HTML

    It worked for me, but note the Note at the end: you need to correct the comment tags by deleting the extra space.

    As for framing, there are fewer objections to the use of an <iframe> to "import" content to a page. But it is considered a nonstandard tag.

  8. #8
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Okay, I'm convinced: I won't use frames. (The only reason I thought they'd be appropriate was because they were the only thing I knew of to do what I wanted.)

    But the way I'm using SSI

    1. I copied from index.htm to header.htm everything from "<!DOCTYPE" to "<hr>, and added at the bottom closing body and html tags.

    2. I removed the div stuff from index and in its place inserted a single line beginning with <!--#include virtual

    chops off the header from index.

    I can't figure out what I'm doing wrong, so I'm attaching my modified index and header HTM files. (I'll attach index to this post, and header to my next one.)

    Thanks so much!
    Attached Files Attached Files

  9. #9
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    > It worked for me, but note the Note at the end: you need to correct the comment tags by deleting the extra space.

    My oversight.

    As per my previous post, responding to Mark, I'm attaching to this post my header file.

    Thanks!
    Attached Files Attached Files

  10. #10
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    I spoke too soon.

    The horizontal line looks fine in Firefox, extending all the way under the Google ad.

    But in Internet Explorer:

    1. The line stops at the ad;
    2. The bottom of the ad, where it says "Advertise on this site," is slightly cut off; and
    3. The Jonathan Rick pic is shifted to the left.

  11. #11
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Jon

    How does look to you?

    Just the addition of a tag seem to do the job, but I want to check if this OK to you.
    Jerry

  12. #12
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Hi Jerry,

    It looks better -- check it out at http://www.jonathanrick.com -- but "Advertise on this site" is still getting lopped off, albeit slightly.

    Thanks, again.

  13. #13
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Hi Jon

    I am at a loss, I have fiddled about with <div> and tried height attributes and am at a loss, it's infuriating. I shall have a go at it on and off this afternoon in between chores <img src=/S/sad.gif border=0 alt=sad width=15 height=15>
    Jerry

  14. #14
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Hi Jon

    Right I have had a fiddle with the code for your header. I decided to make an external cascading style sheet so that I could concentrate more on the code. Having researched Google ads, it appears you have chosen the 125x125 px option, no problems there.

    Looking at the js code for the ad it seems it is hard coded as a 125x125 box and cannot be changed. To test this I created a 125x 125 box class in the css file to test that it was showing correctly. It does.

    Now I am confused that when I view your live site, I see another advert and in a different format to what I see on my local machine, this may be because of the way js files are viewed via a server ( and outside my knowledge)

    I have attached a zip file of what I did, set as a local root folder. Sorry I can't help any further.
    Jerry

  15. #15
    5 Star Lounger
    Join Date
    Jun 2001
    Location
    USA
    Posts
    708
    Thanks
    48
    Thanked 1 Time in 1 Post

    Re: Positioning a Google Ad with HTML

    Hi Jerry,

    Piggybacking on your post, I isolated the ad's HTML into a separate HTM file and determined that the problem lies with Google.

    If the advertiser's URL runs to two lines, then the "Advertise" line gets cut off. If the URL fits on one line, then everything's fine.

    Such shoddiness from Google is hard to believe.

    Thanks so much for your patience and help.

    Best.
    Jon

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •