CSS 特定于浏览器的样式

CSS style specific to browser

我有一个CSSclass如下

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

有了上面的class我想为一个div申请保证金。 在 IE 浏览器中,我想应用 "margin: 10px 8px 2px 20px;",在 chrome 中,我想将边距应用为“-webkit-margin-before : 1em; -webkit-margin-start : 10px;.

但即使在 chrome 中,它也只考虑 "margin: 10px 8px 2px 20px;",而不是 webkit。

margin: 10px 8px 2px 20px; 放在 -webkit-margin-before : 1em;

之前

css 总是采用最后应用到元素的样式。在这种情况下,它将首先应用 margin: 10px 8px 2px 20px; ,然后应用 -webkit-margin-before : 1em; 。在 IE 的情况下,第二行将被忽略。

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