How do I add a css line ONLY for Safari

后端 未结 7 1529
轮回少年
轮回少年 2020-12-28 11:03

I am making a website, but an element needs margin in Chrome and other browsers, but not in safari. So I want to add a css line to fix it, but I can\'t find any method to ad

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 11:27

    Instead of adding more code to fix your problem, since the default margins are different, you could try resetting all off the margins and paddings of surrounding elements to 0 first before changing it. That could solve your issue.

    It's completely a personal preference, but I start all of my webpages with:

    *{
        margin:0;
        padding:0;
    }
    

    I've never had any cross browser issues regarding margins or padding while doing this.

提交回复
热议问题