SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 26
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    force banner to have specific width and height

    how can i force a banner contained in the following code:

    <script type="text/javascript" src="http://sdasdasdsasasdsdsccccc;cre=mu;js=y;target=_blank"></script>

    to have a specific width and height?

    i tried by putting it into a div, but still the banner keeps its original sizes

  2. #2
    SitePoint Member
    Join Date
    Mar 2006
    Location
    Poconos, Pennsylvania
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps having it in a div but do something like, to over ride the image.

    Code:
    #ad_code img { width: 400px; height: 100px }

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    @acqua: To me, it's not really clear what you mean by "a banner contained in the following code". Contained in what way?

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    @acqua: To me, it's not really clear what you mean by "a banner contained in the following code". Contained in what way?
    i have this ad banner ok?
    <script type="text/javascript" src="http://sdasdasdsasasdsdsccccc;cre=mu;js=y;target=_blank"></script>
    and the normal size would be 300x250

    but my needs is to resize it to 200x200 so i need the div to "force" its widht and height, if possible

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by acqua View Post
    i have this ad banner ok?
    <script type="text/javascript" src="http://sdasdasdsasasdsdsccccc;cre=mu;js=y;target=_blank"></script>
    That's not an ad banner. It's a line of JavaScript.

  6. #6
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    That's not an ad banner. It's a line of JavaScript.
    Ok it is a JS and it calls a banner
    Is it possible to set the width and height of the JS?

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by acqua View Post
    Is it possible to set the width and height of the JS?
    No, the JS just pulls in the banner and then gets out of the way. So you need to set the size of the banner. We'd need to see the code that is pulled in to suggest how to target it with CSS.

  8. #8
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    No, the JS just pulls in the banner and then gets out of the way. So you need to set the size of the banner. We'd need to see the code that is pulled in to suggest how to target it with CSS.
    you mean you want to see the code?
    it's more or less like the one i originally posted

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by acqua View Post
    you mean you want to see the code?
    it's more or less like the one i originally posted
    Not the link to the JS file, but the actual HTML that is pulled in by that link. It will probably be a series of divs, perhaps an iframe etc. that contains all the content of the banner.

    Are you able to link to the site? That would be the easiest option.

  10. #10
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Not the link to the JS file, but the actual HTML that is pulled in by that link. It will probably be a series of divs, perhaps an iframe etc. that contains all the content of the banner.

    Are you able to link to the site? That would be the easiest option.

    all i have is this code to put in the page where i need to show the banner:

    Code:
    <script type="text/javascript" src="http://fdssddfsddfsdf.eu/eas?cu=14940;cre=mu;js=y;target=_blank"></script>
    and this other to put in the header code

    Code:
    <script type="text/javascript" language="JavaScript" src="http://fdssddfsddfsdf.eu/EAS_tag.1.0.js"></script>

  11. #11
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    OK, then we'd need to see the site to look at the code, or you can use the web inspector (right click on the banner in Chrome and choose Inspect Element) to see the code that is pulled in by that link.

  12. #12
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Hm, doesn't seem to be easy to manipulate the code much, but you could do something simple like add this to your CSS to make it look a bit better:

    Code:
    ins {
      width: 100% !important;
      background: black;
    }

  13. #13
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can u suggest inline css pls?

  14. #14
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by acqua View Post
    Can u suggest inline css pls?
    No, you can't do it inline, because you don't have access to the code. All you could do is put it in the head of your page like this:

    Code:
    <style>
    ins {
      width: 100% !important;
      background: black;
    }
    </style>

  15. #15
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I put the code in <div class="adv">

    and recall the class in the header:

    <style>
    adv {
    width: 100% !important;
    background: black;
    }
    </style>


    but the banner still show in the un-wanted size

  16. #16
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    You forgot the dot before "adv"

    Code:
    .adv {
    width: 100% !important;
    background: black;
    }

  17. #17
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    You forgot the dot before "adv"

    Code:
    .adv {
    width: 100% !important;
    background: black;
    }
    the problem now is the height change but width doesn't

  18. #18
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    You've set it to a width of 1px and a height of 10px

    Code:
    .adv {
    width: 1px !important;
    height: 10px !important;
    background: black;
    }
    What are you actually trying to do here? Do you want to get rid of it altogether?

  19. #19
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    You've set it to a width of 1px and a height of 10px

    Code:
    .adv {
    width: 1px !important;
    height: 10px !important;
    background: black;
    }
    What are you actually trying to do here? Do you want to get rid of it altogether?
    i simply want to force the banner to have:
    width: 10px
    height 10px

  20. #20
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,360
    Mentioned
    268 Post(s)
    Tagged
    5 Thread(s)
    Quote Originally Posted by acqua View Post
    i simply want to force the banner to have:
    width: 10px
    height 10px
    And are you saying that it doesn't work, even after changing width: 1px !important; (which is apparently what you have) to width: 10px !important; ?

  21. #21
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The width does not change only the height does

  22. #22
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,360
    Mentioned
    268 Post(s)
    Tagged
    5 Thread(s)
    Can you post a link to your site so that we can see the full code and see what's going on here?

  23. #23
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,360
    Mentioned
    268 Post(s)
    Tagged
    5 Thread(s)
    OK, thanks, I got your PM with the link. You still have in your code
    Code:
    <style>
    .adv {
      width: 1px !important;
    height: 10px !important;
      background: black;
    }
    </style>
    Change that 1px to 10px and the width will change.

    Note that round about line 96 you also have
    Code:
    <style>
    adv {
      width: 100px !important;
    height: 10px !important;
      background: black;
    }
    </style>
    That shouldn't be there and you ought to delete it.

  24. #24
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've removed

    Code:
    <style>
    adv {
      width: 100px !important;
    height: 10px !important;
      background: black;
    }
    </style>
    and set width to 10px
    but the width is still 100%

  25. #25
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,297
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by acqua View Post
    the width is still 100%
    I still don't get why you want it so small, because it's going to look awfully weird. Seems like you don't want it there at all. The div that you are setting to width: 10px is indeed going to that width, but the contents inside it are not being reduced in size, but are hanging out to their normal width. You could stop that by adding overflow: hidden; to the code above:

    Code:
    .adv {
      width: 100px !important;
      height: 10px !important;
      background: black;
      overflow: hidden;
    }
    You will only get a small, ten pixel square box doing this, though. What's your goal?


Bookmarks

Posting Permissions

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