# Solved: Different CSS For Firefox And Internet Explorer



## TW.87 (Dec 30, 2005)

If I have a tag like this:

```
<div class="Box1">Content</div>
```
Is there a way to have it use the "Box1" class from the CSS differently depending on the Internet browser? For example, is there a way to have the "" use the "Box1" class if the Internet browser is Internet Explorer, while it would use the "Box2" class if it was Firefox?

The reason I need this is that I have a "" element that is being displayed slightly different in the two Internet browsers, and with a small adjustment in the CSS, it can look identical. The problem is that the small adjustment does not remedy the issue unless I can find a solution like I have described above.

Any help would be appreciated.


----------



## watchintv (May 27, 2005)

Well, you could use a CSS hack I suppose, but I don't reccommend using one becuase it will probably break in IE 7. Another alternative is to use two stylesheets, one for IE and one for Firefox. While this does make broswer compatibility easier, it also means that if you are changing your code or doing CSS work, you will need to apply the changes to each stylsheet. Which may or may not be a hassle to you unless your working with a large stylesheet. The other downside is this will also require more HTTP requests, but this is usually not a problem. These are just the two ways I know to correct browser compatibility issues, there may be more ways though.


----------



## thecoalman (Mar 6, 2006)

Adding a nderscore before a property will hide it from everything but IE.



> DIV
> {
> _width: auto;
> }


There's probably one for FF too but I never looked. I get things working right in FF first then fix IE. If you post your code it might be something simple to fix.


----------



## TW.87 (Dec 30, 2005)

Okay, thank you! I'll give that a go and see where it takes me.


----------

