1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

CSS issue - formatting different in IE and Firefox

Discussion in 'HTML & JavaScript' started by dor@tehexploa, Apr 30, 2009.

  1. dor@tehexploa

    dor@tehexploa Registered Member

    Joined:
    Apr 25, 2009
    Messages:
    95
    Likes Received:
    25
    my web page is at w w w DOT insidious DOT ws
    it looks exactly how i want it to in Firefox, but unfortunately it is seriously screwed in internet explorer

    does anyone know what I could do to fix this?
     
  2. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,884
    Likes Received:
    1,932
    I hate CSS, I usually just use PHP to detect the browser (If IE then display style sheet IE.css else show css.css)
     
    • Thanks Thanks x 1
  3. dor@tehexploa

    dor@tehexploa Registered Member

    Joined:
    Apr 25, 2009
    Messages:
    95
    Likes Received:
    25
    that's a good tip. thanks man. I'ma look into finding a PHP script to do just that..
     
  4. shm03

    shm03 Regular Member

    Joined:
    May 19, 2008
    Messages:
    284
    Likes Received:
    123
    welcome to the world of web design, it can be a nightmare to get everything to work on both ie and ff and opera etc... best thing if its not a really popular site is to just do what gimme4free said.
     
  5. dor@tehexploa

    dor@tehexploa Registered Member

    Joined:
    Apr 25, 2009
    Messages:
    95
    Likes Received:
    25
    Hmmm I can't seem to find any scripts that are working on my web server. I'm not a pro at PHP so I'm not really sure what to look for. :(
     
  6. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,884
    Likes Received:
    1,932
    PHP:
    <? 
    if ( 
    strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') )
    {
    echo 
    "<link href=\"ffstyle.css\" rel=\"stylesheet\" type=\"text/css\">";
    }
    else{
    echo 
    "<link href=\"style.css\" rel=\"stylesheet\" type=\"text/css\">";
    }
    ?>
     
    • Thanks Thanks x 1
  7. rhino

    rhino Junior Member

    Joined:
    Jun 3, 2008
    Messages:
    128
    Likes Received:
    126
    Occupation:
    crazy netropeneur
    Location:
    Bronx Zoo, USA
    here is link that should help with your issue...sounds like you need to switch css depending on the browser. go to the bottom of the page.

    http://www.javascriptkit.com/dhtmltutors/csshacks.shtml

    (this site in general is a great education in web work)

    R-

    ps- gimme4free - thanks for the php version
     
    Last edited: Apr 30, 2009
  8. gimme4free

    gimme4free Executive VIP Jr. VIP Premium Member

    Joined:
    Oct 22, 2008
    Messages:
    1,884
    Likes Received:
    1,932
    Or a version for lots of browsers:

    PHP:
    <?php
    function get_user_browser()
    {
        
    $u_agent $_SERVER['HTTP_USER_AGENT'];
        
    $ub '';
        if(
    preg_match('/MSIE/i',$u_agent))
        {
            
    $ub "ie.css";
        }
        elseif(
    preg_match('/Firefox/i',$u_agent))
        {
            
    $ub "firefox.css";
        }
        elseif(
    preg_match('/Safari/i',$u_agent))
        {
            
    $ub "safari.css";
        }
        elseif(
    preg_match('/Chrome/i',$u_agent))
        {
            
    $ub "chrome.css";
        }
        elseif(
    preg_match('/Flock/i',$u_agent))
        {
            
    $ub "flock.css";
        }
        elseif(
    preg_match('/Opera/i',$u_agent))
        {
            
    $ub "opera.css";
        }
       
        echo 
    "<link href=\"$ub\" rel=\"stylesheet\" type=\"text/css\">";;
    }
    ?>
     
  9. 00CivicEX

    00CivicEX Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 3, 2009
    Messages:
    293
    Likes Received:
    214
    or just modify your CSS to a Liquid CSS....It auto adjust to the browsers. Do a google search.