1
votes

I have a CSS class as follows

.sub-title
{
    -webkit-margin-before : 1em;
    -webkit-margin-start : 10px;
    margin: 10px 8px 2px 20px;
    overflow-wrap: break-word;
}

With the above class I want to apply margin for a div. In IE browser i want to apply "margin: 10px 8px 2px 20px;" and in chrome i want to apply margin as "-webkit-margin-before : 1em; -webkit-margin-start : 10px;".

But even in chrome, it is considering "margin: 10px 8px 2px 20px;" only, instead of webkit.

1

1 Answers

2
votes

place the margin: 10px 8px 2px 20px; before -webkit-margin-before : 1em;

css always takes the last style applied to an element. In that case first it will apply themargin: 10px 8px 2px 20px; and then the -webkit-margin-before : 1em; . in case of IE the second line will be ignored.

.sub-title
{
    margin: 10px 8px 2px 20px;
    -webkit-margin-before : 1em;
    -webkit-margin-start : 10px;
    overflow-wrap: break-word;
}