Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with safari css...

    I have a form that works great on all browers except for Safari. I've narrowed it down to be a margin value that needs to be

    "margin: 0;" for Safari

    and "margin: -17px 0 0 0;" for everything else.

    Anyone know of a hack that only Safari sees?

    ps The safari version is the latest version.

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    There are a few, but the trouble is then Moz also gets the brush off... There was a thread on this not too long ago:

    http://www.codingforums.com/showthread.php?t=47567

    Hope it helps,

  • #3
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts

    Post

    You could use some javascript, along with two css files, ine for safari, one for everyone else:

    Code:
    var safari = false;
    var agent = navigator.userAgent.toLowerCase();
    if (agent.indexOf("safari") != -1){
    //code to show Safari Stylesheet
    }
    else{
    //Code to show everybody else's stylesheet
    }
    Good Luck, Dan

  • #4
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Looks like that won't work, but close...

    http://codingforums.com/showthread.p...374#post271374

  • #5
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Dan,

    It worked perfectly. How would I add Opera to this script? Opera does the same thing as Safari....

    Code:
    <script language="javascript">
    <!--
    var safari = false;
    var agent = navigator.userAgent.toLowerCase();
    if (agent.indexOf("safari") != -1){
    //code to show Safari Stylesheet
    document.write('<link rel="stylesheet" type="text/css" href="css/safari.css" \/>');
    }
    else{
    //Code to show everybody else's stylesheet
    document.write('<link rel="stylesheet" type="text/css" href="css/screen.css" \/>');
    }
    //-->
    </script>

  • #6
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts

    Post

    It worked perfectly. How would I add Opera to this script? Opera does the same thing as Safari....
    here is the code which will handle both opera and safari:

    Code:
    <script language="javascript">
    <!--
    var safari = false;
    var opera = false;
    var agent = navigator.userAgent.toLowerCase();
    if (agent.indexOf("safari") != -1){
    //code to show Safari Stylesheet
    document.write('<link rel="stylesheet" type="text/css" href="css/safari.css" \/>');
    }
    else if(agent.indexOf("opera") != -1){
    //code to show Opera Stylesheet
    document.write('<link rel="stylesheet" type="text/css" href="css/opera.css" \/>');
    }
    else{
    //Code to show everybody else's stylesheet
    document.write('<link rel="stylesheet" type="text/css" href="css/screen.css" \/>');
    }
    //-->
    </script>
    good luck, dan

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by whizard
    You could use some javascript, along with two css files, ine for safari, one for everyone else:
    That won't reliably work - Safari doesn't always have "safari" in its UA string.

    You'd be better off trying to find a CSS solution that works in Safari and Opera in the first place. Have you got a demo of the problem?
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #8
    New to the CF scene
    Join Date
    Jan 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    LOVE the css javascript thanks so much guys !

    <script language="javascript">
    <!--
    var safari = false;
    var agent = navigator.userAgent.toLowerCase();
    if (agent.indexOf("safari") != -1){
    //code to show Safari Stylesheet
    document.write('<link rel="stylesheet" type="text/css" href="css/safari.css" \/>');
    }
    else{
    //Code to show everybody else's stylesheet
    document.write('<link rel="stylesheet" type="text/css" href="css/css.css" \/>');
    }
    //-->
    </script>


  •  

    Posting Permissions

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