Is there a way to set any style for a specific browser in CSS?

后端 未结 3 1205
孤独总比滥情好
孤独总比滥情好 2020-12-29 10:35

For example, if I want to set the corner radius in Webkit, Firefox and other than I can use the following CSS:

-webkit-border-radius: 8px;
-moz-border-radi         


        
3条回答
  •  情话喂你
    2020-12-29 11:13

    As far as I know, prefixes were added to properties when CSS3 was being implemented by different browsers, and just property wouldn't work so we'd use -prefix-property for certain properties like gradient or border-radius. Most of them work without the prefix now for most browsers, and the prefix system has been kept only for backward compatibility.

    For example, if I want to change the margin only in Firefox could I simply add the prefix like so:

    -moz-margin:-4px; margin: 1px;

    This won't work. You can, however use different stylesheets for different browsers (say IE) in this manner:

    
    

    The browser-specific prefix version thing doesn't exist.

    Hope this answers your question.

提交回复
热议问题