Different margin for IE, firefox,chrome

Hi CSS Great minds,

I have a column where

margin-left:10px ; for firefox
margin-left:30px ; for IE
margin-left: 40px ; for chrome.

Can someone tell me how do i assign these for those browser specific in a CSS class. Waiting to hear .
I tried like this-

.class1 {
  margin-left:10px !important ; /*Firefox*/
  margin-left:30 px;/*IE*/

for chome??? but this did not work. let me know .


You can’t really target specific browsers like that, except for older version of IE. But why would you want to? Do you really want to set different margins on different browsers, and if so why?

It sounds like there is a deeper issue you are trying to band-aid here; can we try and target the source of the problem? Demo page please, along with what issue you are seeing :slight_smile: .


Ralph and Ryan — I was trying to adjust an existing column . On adjusting, it took different margins for different browsers. Any thoughts?


As the others have said this is likely to be a problem with your code as browsers will render margins consistently and there is never (rarely ever) a need to have different margins like you are specifying.

We’d need to see a demo of the problem to fix properly.

(If this element is a ul or ol (and assuming you don’t want bullets) then make sure you have set left padding to zero as browsers apply varying amounts of default padding in which to show the list marker.)

1 Like

Well we can’t do anything without some sort of code or demo :slight_smile: .

Right; and this is why I think you are band-aiding some deeper problem.

Have you validated your code?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.