SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    different css for firefox and IE

    is there a way to check what browser the user is using, and if hes using IE then make it so that one div has a different css or something, because my index page keeps looking all messed up, and by a couple of pixels. heres my index

    http://www.board-source.com

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please fix your X/HTML errors.

    Lose the <font> elements. This is a bit old, but much of what it says is relevant -- What's wrong with the FONT element?
    What should you use instead of the FONT element? Beyond the FONT tag: Practical HTML text styling

    Why should you avoid using tables for layout?

    You may want to have a look through Explorer Exposed!.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im not using tables for layout... its css, i do use tables, but its not for my sites layout.... and you didnt really answer my question which did have to do witht css.

    also while im at it... why isnt the javascript im trying out working. What im trying to do is have a hidden div with an image show up whe i roll over the thumbnails, and it works, but once you go over the bottom ones, rolling over the top ones doesnt work anymore... not to mention that in IE the hidden div appears next to the old one.

  4. #4
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    X/HTML errors can affect how browsers render pages.

    I suggest yuo read Why we won’t help you [dive into mark]
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  5. #5
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay, i dont think validating it is going to help me with the javascript problem... plus, one of its issues is the embed tag, and i have no choice but to use it because its what youtube gives you.... ill go try and fix as many problems as i can, but in the meantime... can you please just answer my first question... checking browser to use 2 different css files?

    thanks

  6. #6
    Non-Member deathshadow's Avatar
    Join Date
    Jul 2006
    Location
    Dublin, NH
    Posts
    901
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by franco714 View Post
    im not using tables for layout... its css, i do use tables, but its not for my sites layout.... and you didnt really answer my question which did have to do witht css.
    Uhm, yes you are... at least from what I'm seeing - and unneccessary tables at that...

    Being it's a fixed width layout - and from what I'm seeing on a simple perusal (and the fact the layout is ALSO broken in Opera and Safari)

    I'm seeing about twice the CSS that site should need, and the HTML is just 'overboard' on being WAY more complex than it should be.

    Gimme a couple hours to finish up another project, and I'll take a stab at throwing together a template based on your home page to show you some alternate ways of doing things.

  7. #7
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay, thanks a lot.... i had no idea i was complicating myself

  8. #8
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz View Post
    X/HTML errors can affect how browsers render pages.

    I suggest yuo read Why we won’t help you [dive into mark]
    it really sucks that you really just couldnt give me some advice as simple as a conditional comment like

    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="style-ie.css" />
    <![endif]-->

    just because i didnt have my site validated, and that i had to go to another forum to find out how to do it

  9. #9
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,389
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    it really sucks that you really just couldnt give me some advice as simple as a conditional comment like
    Well the problem with handing out advice like that is that you don't learn anything from it.

    You have just linked to a whole separate stylesheet for ie which means you've doubled the browsers work load already. If you need to apply a fix for ie then you should only apply the changes needed and not the whole stylesheet.

    However you should only offer different code when you encounter a known bug or behaviour. Most of the time positional differences will be down to poor code or structure or simply not taking care of the default margins/padding that are applied to all elements and vary from browser to browser.

    You have also offered the code to all IE which includes ie7 and usually ie7 is different in behaviour to ie6, which is another reason to be careful with your hacks.

    The differences could be that your code is invalid and you have badly nested tags so you are relying on the browser making a guess. You must have valid code first before you can get to the root of the problem and it really is good manners to tidy up your code when asking for help.

    I notice in your code that you have used height:100&#37; which unless you know what you are doing may cause you problems later. When you set a height then basically that is all you will get (except that you can't set a percentage height on a static container that is height:auto).

    If deathshadow is working on a template you should see a design that works without hacks and uses the same code for all browsers (apart form any known IE bugs.

    Remember that alternative code (or hack) is only used as a last resort and you are sure that you are dealing with a known bug or known buggy behaviour. It makes so much easier if you don't have to do everything twice

  10. #10
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ill try to keep my code a little tidier, im still pretty new to all of this, been doing it for about 3 months, buy yeah thanks a lot for taking the time to explain all that, i just thought kravitz answers were a little short and quite useless, sort of as if he didnt really care about helping.

    also sometime when im trying to validate my page, theres a lot of problems that i cant really figure out how to fix, cuz their explanation might as well be chinese to me. i mean hell, not even this page is validated, we cant all be perfect

  11. #11
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,389
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    cuz their explanation might as well be chinese to me.
    Yes, I had the same problems originally but as you work your way through them they become second nature. The validation results could be a bit more user friendly I must admit but If you have trouble with working out what something means then you can always post in the forums to ask a specific question.

    The thing about validating is that it takes care of the obvious errors such as typos and missing tags which we all do at some time and can pass unnoticed even though you have looked at the code a million times.

    mean hell, not even this page is validated,
    Yes but this page is 10 times longer than your page and only has 1 error whereas your page has 38 errors .

    Validating your page also helps you understand the document structure a bit better as it forces you to address specific problems and although the errors are rather cryptic they are usually relevant. It just takes a bit of practice


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
  •