轮廓:无VS轮廓:0 [英] outline: none VS outline: 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 propertiesoutline-style
,outline-width
andoutline-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
is0
, theoutline-width
is0px
- When the
outline
isnone
, theoutline-width
ismedium
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屋!