SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot Kamran's Avatar
    Join Date
    Sep 2000
    Location
    UK
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Trying to get images in the center

    Hi all,

    I'm hoping someone could help with this, seems pretty simple but I just can't seem to get this to work correctly. I'm just trying to display some ad boxes in the sidebar of my site but they will just not sit in the center.

    This is the code I'm using:

    Code:
    <div class="ad-box">
    ad code here
    </div>
    In our style.css I have:

    Code:
    #sidebar .ad-box {
        background:url(images/border01.gif) repeat-x;
        height:1%;
        padding:0 13px 2px 16px;
        overflow:hidden;
        margin:16px 0 0;
    }
    #sidebar .ad-box ul {
        height:1%;
        padding:0;
        margin:8px 0 0;
        list-style:none;
        overflow:hidden;
    }
    #sidebar .ad-box ul li {
        float:left;
        margin:18px 0 0;
        padding:0 19px 0 0;
    }
    #sidebar .ad-box ul img {
        display:block;
        border:1px solid #ddd;
    }
    I'm not a coder/designer but I would normally use trial and error with this type of stuff however nothing seems to work. This code was part of the original template I had coded a few years back which I was hoping would work.

    Here is a screen shot of how it looks at the moment, as you can see there is too much space on the right side.

    adcodefix.png

    Any help/advice would be appreciated.

    Thanks

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,316
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    If the sidebar has a fixed width, you could put some left margin on it to move it over. Or, if you know the width of the UL or the containing div, you could set the width in CSS and then set the left and right margins to "auto".

    We could give you a definite answer in a jiff if we had a live link. Is this online?

  3. #3
    SitePoint Zealot Kamran's Avatar
    Join Date
    Sep 2000
    Location
    UK
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Ralph,

    Thanks for the quick reply.

    Here is a content page from the site, I've removed the above ad code but you can see the rest of the sidebar there.

    Thanks

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,316
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by Kamran View Post
    I've removed the above ad code but you can see the rest of the sidebar there.
    If you want help centering it, we'd need to see it in there to know what code to target. Can you put it back in?

  5. #5
    SitePoint Zealot Kamran's Avatar
    Join Date
    Sep 2000
    Location
    UK
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, sorry, it's displaying now.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,316
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Try adding this to your style sheet:

    Code:
    #bsap_1280001 {
      width: 260px;
      margin: 0 auto;
    }

  7. #7
    SitePoint Zealot Kamran's Avatar
    Join Date
    Sep 2000
    Location
    UK
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That worked, thanks so much for the help Ralph!

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,316
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    You're welcome.


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
  •