Center an ad script?

Discussion in 'PHP' started by Lucas806, May 12, 2013.

  1. #1
    I have been given an ad code to put on my website. I would like to center it. Here's the code:
    <!-- BEGIN RICH-MEDIA blinkx Media CODE -->
    <script type="text/javascript">
    rnum=Math.round(Math.random() * 100000);
    ts=String.fromCharCode(60);
    if (window.self != window.top) {nf=''} else {nf='NF/'};
    if (typeof(unishowed) == 'undefined'){sa = ''} else {sa = 'SA/'};
    if (typeof(addinfo) == 'undefined'){reqstr = ''} else {reqstr = addinfo};
    document.write(ts+'script src="http://bmuk.burstnet.com/bmuk/display/s=26510/a=a/v=4.0S/KW=/sz=468x60A/NZ/'+rnum+'/'+nf+sa+reqstr+'RETURN-CODE/JS/">'+ts+'/script>');
    </script>
    <noscript>
      <a href="http://bmuk.burstnet.com/bmuk/clk/s=26510/a=a/v=4.0S/ns/sz=468x60A/KW=" target="_top">
      <img src="http://bmuk.burstnet.com/bmuk/display/s=26510/a=a/v=4.0S/ns/sz=468x60A/KW=" border="0" alt="Click Here" /></a>
    </noscript>
    <!-- END blinkx Media Ad Network CODE -->
    PHP:

     
    Lucas806, May 12, 2013 IP
  2. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #2
    Do you want the center the content or do you want to center the element it's in? Post a link or the code for your site.

    If you want the center the element then you would do this with CSS.
    <div style="width:300px;margin:0px auto;">
    <!-- ad code here -->
    </div>
    Code (markup):
    If you want to center the text then add text-align:center; to the element.
     
    HuggyStudios, May 12, 2013 IP
  3. Lucas806

    Lucas806 Greenhorn

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #3
    My site is clubpenguincheating.com - The ad is currently displaying under the header and I basically want to center it.
     
    Lucas806, May 12, 2013 IP
  4. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #4
    Add this code under this: <div id="content-main" class="clearfix grid_11">
    
    <div style="width:728px;margin:0px auto;text-align:center;">
     
    <!-- BEGIN RICH-MEDIA blinkx Media CODE -->
      <script type="text/javascript">
      rnum=Math.round(Math.random() * 100000);
      ts=String.fromCharCode(60);
      if (window.self != window.top) {nf=''} else {nf='NF/'};
      if (typeof(unishowed) == 'undefined'){sa = ''} else {sa = 'SA/'};
      if (typeof(addinfo) == 'undefined'){reqstr = ''} else {reqstr = addinfo};
      document.write(ts+'script src="http://bmuk.burstnet.com/bmuk/display/s=26510/a=a/v=4.0S/KW=/sz=468x60A/NZ/'+rnum+'/'+nf+sa+reqstr+'RETURN-CODE/JS/">'+ts+'/script>');
      </script>
      <noscript>
      <a href="http://bmuk.burstnet.com/bmuk/clk/s=26510/a=a/v=4.0S/ns/sz=468x60A/KW=" target="_top">
      <img src="http://bmuk.burstnet.com/bmuk/display/s=26510/a=a/v=4.0S/ns/sz=468x60A/KW=" border="0" alt="Click Here" /></a>
      </noscript>
      <!-- END blinkx Media Ad Network CODE -->
     
    </div>
    
    Code (markup):
    Change the width to match what you need, ideally you shouldn't use inline styles unless there's a specific reason to. You should add those CSS rules to a class and then assign that class to this element.
     
    HuggyStudios, May 12, 2013 IP
  5. Lucas806

    Lucas806 Greenhorn

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    I tried that, it's not exactly centered properly. Look at it.
     
    Lucas806, May 12, 2013 IP
  6. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #6
    Yes I did say change the width to what you need, set it to 630px see how it looks and just adjust it accordingly.
     
    HuggyStudios, May 12, 2013 IP