Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    my site ads are in different areas depending on screen resolution

    hey guys my website ads get displayed weird depending on the resolution. On my 23in 1080p they look fine but on my bros 1440x900 or something like that the banner ad get moved to the right a little. Is there anyway to keep the ads in place on all resolutions ? Any code for this.

    Im using wordpress so i guess its html/css

    If anyone could help me, id appreciate it. thanks. If you want to take a look at the site its www.kzkomputers.com

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello huntsman,
    Making the containing element position: relative; will make positioned elements inide it stay where you put them.
    Add this bit in red -
    Code:
    .wrapper{ 
    width:960px; 
    margin:0 auto;
    position: relative;
    }
    Then adjust the position of your ad.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So all i have to add is position relative;

    and thats it ?

    Also where would i add it, I go into my header.php thats where the ad is located. Here is the script for my ad, or at least how it is now.

    <div style="width:400px; height:100px; position:absolute; left:37%; margin-top:70px"><script type="text/javascript"><!--
    google_ad_client = "ca-pub-7004674886429240";
    /* lead */
    google_ad_slot = "8298540578";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></div>

    So now where would i add this position relative; ? Sorry if i sound dumb but i never messed around with css or html before. First time learning

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by huntsman View Post

    So now where would i add this position relative; ? Sorry if i sound dumb but i never messed around with css or html before. First time learning

    It looks fixed now. Did you figure it out?
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #5
    New Coder
    Join Date
    Nov 2011
    Posts
    10
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by huntsman View Post
    So all i have to add is position relative;

    and thats it ?

    Also where would i add it, I go into my header.php thats where the ad is located. Here is the script for my ad, or at least how it is now.

    <div style="width:400px; height:100px; position:absolute; left:37%; margin-top:70px"><script type="text/javascript"><!--
    google_ad_client = "ca-pub-7004674886429240";
    /* lead */
    google_ad_slot = "8298540578";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></div>

    So now where would i add this position relative; ? Sorry if i sound dumb but i never messed around with css or html before. First time learning
    Hello,

    You would change the word "absolute" to "relative".

    Btw, your code looks very confusing. The reason being that you have your style elements and javascript together with your HTML. The best way to create a page is to have your CSS code and Javascript code in separate files from your HTML file.
    Last edited by StockDC2; 11-26-2011 at 10:48 AM.

  • #6
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes i managed to figure it out. Thank you guys.


  •  

    Posting Permissions

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