什么是HTML的< a>< / a>标签默认显示类型? [英] What is HTML's <a></a> tag default display type?
问题描述
我没有找到任何说明默认显示在CSS的显示属性中等同的东西。我问,因为每当我尝试添加填充或边距到< a>
标记,它不添加它,我必须添加display属性 inline-block
。
我不知道这是不是浏览器特定的,显示它 inline
与说 inline-block
(我显然知道它不是 inline-块 c>。 $
$ c>默认情况下,水平边距和所有边的填充应该工作,而不必更改其显示
属性。
<如果你在一个
< a>
元素中应用样式,该元素包含流元素或在CSS中表示为 display:block
,您应该将< a>
本身设置为正确的块容器类型,例如 block
或 inline-block
,以使布局按预期工作。 I haven't been able to find anything that says what the default display is equivalent to in CSS's display properties. I ask, because whenever I attempt to add padding or margin to an <a>
tag, it doesn't add it, I have to add the display property of inline-block
for it to.
I don't know if this is browser specific or not, but would the default display of it be inline
versus say inline-block
(I obviously know it's not inline-block
.
It is always display: inline
by default. Horizontal margins, and padding on all sides should work without having to change its display
property.
This remains true even in HTML5. If you are applying styles to an <a>
element that contains flow elements or any other elements that are represented in CSS as display: block
, you should set the <a>
itself to a proper block container type such as block
or inline-block
for its layout to work as intended.
这篇关于什么是HTML的< a>< / a>标签默认显示类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!