Need help aligning 120x600 ads left/right outside site container

Discussion in 'CSS' started by rude, Oct 9, 2011.

  1. #1
    Hello

    I have been trying to get this to work for a week now and still can't get it to work the correct way. What i need is to have 120x600 ads on the left and the right of my site on the outside of the site page.

    So when say a person with a small screen results-ion view my site the ads on the left and right would disappear because the ads would adapt with there screen size.

    Now say if someone with a big screen resultsion view the site the ads would show this an example adsonside.jpg

    any help would be very appreciated
     
    rude, Oct 9, 2011 IP
  2. HuggyEssex

    HuggyEssex Member

    Messages:
    297
    Likes Received:
    4
    Best Answers:
    2
    Trophy Points:
    45
    #2
    This isn't a CSS issue you need to use Javascript, google navigator object model javascript, that will give you the information you need.
     
    HuggyEssex, Oct 9, 2011 IP
  3. rude

    rude Well-Known Member

    Messages:
    126
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #3
    yes someone told me this also can you help me doing this?
     
    rude, Oct 9, 2011 IP
  4. zabalex

    zabalex Member

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #4
    Hi,
    both javascript and css are required to do this the right way. To display the ads on your website you need to put the css code.
    Just use two div one for left and other for right.
    Make both the div fixed (if you want to make it appear even if the rest of the page is being scroll down) position:fixed;
    After making both the divs appear on the left and right side, you need a javascript code to detect if the screen resolution is able to deliver the ads.
    You can write code to display left ads or right ads or both at the same time depending upon the screen resolution.

    regards
    zabalex
     
    zabalex, Oct 9, 2011 IP
  5. rude

    rude Well-Known Member

    Messages:
    126
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #5
    that's about correct but can some one write up this code for me if i could i would.
     
    rude, Oct 9, 2011 IP
  6. you-me

    you-me Peon

    Messages:
    67
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    if you still not able to fix, use w3school site to learn some javascript and css. Use screen.width to detect width of screen in javascript.
     
    you-me, Oct 9, 2011 IP
  7. yho_o

    yho_o Well-Known Member

    Messages:
    354
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    #7
    css:

    #rightAds { width:120px; height:600px; position:fixed; right:0; top:0; }
    #leftAds { width:120px; height:600px; position:fixed; left:0; top:0; }
    Code (markup):
    html:

    
    <div id="rightAds">insert your right ads code here</div>
    <div id="leftAds">insert your left ads code here</div>
    
    Code (markup):
     
    yho_o, Oct 10, 2011 IP
  8. rude

    rude Well-Known Member

    Messages:
    126
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    121
    #8
    i got it to work thanks
     
    rude, Oct 10, 2011 IP