SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Object detection: replacing the css file.

    Ok.

    So I was having a problem with a site I have been coding, it was displaying like a shipwreck in IE, but it seems that with some re-coding it works in all the browsers now (almost). There are still slight problems with IE however.
    It's as if explorer simply ignores half my positioning from the css file. Things that should be very simple to place, eg: top: 0px; just get disregarded..

    So, I was wondering if it's possible to do a specialised css file for IE, one that would only come into play if the visitor is using explorer. I think it could be possible by using object detection somehow, I'm just not sure how to go about it.

    Any help would be much appreciated.
    Regards,

    Jimzip

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,231
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)

    IE only CSS

    Best practice is to NOT do browser detection. You can use conditional comments in your mark-up to have IE use a special CSS file.

  3. #3
    SitePoint Member
    Join Date
    Jun 2006
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah.

    That's good news I suppose.
    Any suggestions? I'm not quite sure where to go from here..

    It's actually only two small parts of the page, two image sections, that are causing difficulties.
    They should be 8px above where they are, but IE refuses to aknowlegde the position tags in my css file..

    It has something to do with the page margin. For some reason IE doesn't let anything go out of the boundaries of another element. I want something aligned with the absolute top of the page, but I can't make it so.

    Examples:

    Image in IE
    Image in Safari, Firefox, etc..
    (Focussing here on the nav bar..)

    Jimzip

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,231
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)

    Ie Css

    If it's only a couple of things and you don't need a completely different CSS file you could just put it in the head after the "good" CSS, or call the IE file after the other CSS file
    HTML Code:
    <!--[if IE 5]> /* whatever version */
    .problem1 {left: 0;}
    ......
    <![endif]-->
    or
    HTML Code:
    <link .... /* regular CSS file */
    <!--[if IE 5]>
    <link ......
    <![endif]-->
    The MS page has more info, and you can to find more examples of use. http://msdn.microsoft.com/library/?u...omment_ovw.asp


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
  •