I'm working on a website for my dad, and it works nice in modern browsers, but apparently he's getting comments on how the top navigation doesn't work on Internet Explorer (7 and lower, I think). It shifts to the right instead of centering in the middle.

How do I fix this? Or, is there some sort of if/or conditional comment thing I can do that says:

IF IE... use this class for the div / OR (any other browser) use this other class

You can use conditional comments to target specific versions of Internet Explorer. In your case you would want to target IE7 and lower so you would use:

<!--[if lt IE 7 ]>
  <style type="text/css">
    <!-- Your special rule to fix the CSS issue goes here -->
  • @Maddy "IE use this class for the div … any other browser use other class" They will still use the same class, but the definitions differ. The CSS for IE7 should be included after your 'normal' style sheet and should overwrite the desired classes. – feeela Jul 22 '11 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.