轮廓:无VS轮廓:0 [英] outline: none VS outline: 0

查看:132
本文介绍了轮廓:无VS轮廓:0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读



如您所见,他们都使用默认文本颜色作为 outline-color ,并且它们都将 outline-style 设置为 none 。唯一的区别是 outline-width




  • c> outline 是 0 outline-width 0px

  • 大纲 none outline-width medium



这是两者之间的唯一区别。你可以使用任何一个,它们都将以相同的方式显示(因为 outline-style none 不管大纲有多宽)。


I was reading this question on disabling the dashed borders around <a> links. Some answers used outline: none, while some used outline: 0

Is there any difference between using outline: none and outline: 0?

解决方案

According to MDN:

The CSS outline property is a shorthand property for setting one or more of the individual outline properties outline-style, outline-width and outline-color in a single declaration

So when you set outline to none or 0, you are actually telling the browser to set 3 properties (outline-style, outline-width and outline-color)

I used Firefox Developer Tools to find out the difference:

As you can see, they both use the default text color as the outline-color, and they both have outline-style set to none. The only difference is the outline-width:

  • When the outline is 0, the outline-width is 0px
  • When the outline is none, the outline-width is medium

That is the only difference between the two. You can use either one, they will both display the same way (since the outline-style is none, it does not matter how wide the outline is).

这篇关于轮廓:无VS轮廓:0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆