1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Absolute Positioning: Backgrounds and Browsers

Discussion in 'CSS' started by ResaleBroker, Mar 28, 2005.

  1. #1
    I've put together a basic page while trying to figure out "Absolute Positioning". For some reason the background [red] of the "navlist" DIV is offset when viewed through a Mozilla browser.

    Any ideas on how to correct this?
     
    ResaleBroker, Mar 28, 2005 IP
  2. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to add "display: block" to your anchors inside navlist:

    #navlist a {
    display: block;
    ...

    J.D.
     
    J.D., Mar 28, 2005 IP
  3. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Thanks J.D. for taking a look. I added the code you suggested however it change the navigation from horizontal to vertical in IE. Any ideas?
     
    ResaleBroker, Mar 28, 2005 IP
  4. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #4
    IE has a bug with block-level anchors. Adding explicit width in pixels should fix it.

    J.D.
     
    J.D., Mar 28, 2005 IP
  5. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #5
    Thanks again J.D., it seems like one issue dissappears and another raises its ugly head.

    Now the background for the "navlist" DIV doesn't show up in Firefox. Any ideas?
     
    ResaleBroker, Mar 28, 2005 IP
  6. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I don't have time to look at the source. Try changing the height of the element in question. Floats are not the kind of content that makes div's grow, so you will need to set the height explicitly (otherwise the containing element collapses, which what seems to be happening on your page).

    Also, keep in mind that if you have any inline elements (i.e. with display other than block), they ignore the height property altogether and expect line-height to be used instead.

    J.D.
     
    J.D., Mar 28, 2005 IP
  7. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #7
    J.D., your the best. That fixed it. Thank You! :)

    You wouldn't happen to know how to "center" a DIV that is using "Absolute Positioning" would you?
     
    ResaleBroker, Mar 28, 2005 IP
  8. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #8
    This looks great in every browser except Opera. For some reason the text looks stretched. Is this something normal for Opera or did I goof up the code?
     
    ResaleBroker, Mar 29, 2005 IP
  9. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Looks like it's text size. You can try letter-spacing or just decrease font size.

    J.D.
     
    J.D., Mar 29, 2005 IP
  10. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #10
    By controlling the font properties [size, spacing] I can get this to work but then it wouldn't look good in the other browsers. This is the only browser I've tested that gives this result.

    Any ideas?
     
    ResaleBroker, Mar 29, 2005 IP
  11. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Getting file-not-found. Anyway, give it a try, it may look Ok if all browsers stick with the spacing you specified (that is, if Opera uses different default letter spacing, setting it explicitly should fix your problem)

    J.D.
     
    J.D., Mar 29, 2005 IP
  12. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #12
    Sorry, you must have been on during the time I was messing with the page.

    After looking at the page in Opera more than just the navigation looks off. I believe I've been very explicit in terms of defining elements but for some reason that page isn't displaying properly with Opera.

    Krud! :(
     
    ResaleBroker, Mar 29, 2005 IP
  13. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #13
    If you set explicitly font family and size for #navlist a, both FF and Opera will display the menu in a similar way. As far as I can see, the rest of the page seems to be very close in both browsers.

    J.D.
     
    J.D., Mar 29, 2005 IP
  14. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #14
    I've done that but the problem hasn't gone away. I'm wondering if it's a browser issue? I'm new to CSS but I'm pretty sure the code is correct.
     
    ResaleBroker, Mar 29, 2005 IP
  15. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #15
    I did try changing font size and family and it fixed the problem (i.e. menu wrapping to the next line in Opera).

    J.D.
     
    J.D., Mar 29, 2005 IP
    ResaleBroker likes this.
  16. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #16
    I changed the font from Sans-serif to Arial and it corrected the menu wrapping problem.

    I really appreciate all of your time and efforts. Thank You Again! :)
     
    ResaleBroker, Mar 30, 2005 IP