h1的保证金底部不起作用

时间:2018-01-03 20:22:54

标签: html css

node { // Version of node to use. version = '0.11.10' // Version of npm to use. npmVersion = '2.1.5' // Version of Yarn to use. yarnVersion = '0.16.1' // Base URL for fetching node distributions (change if you have a mirror). distBaseUrl = 'https://nodejs.org/dist' // If true, it will download node using above parameters. // If false, it will try to use globally installed node. download = true // Set the work directory for unpacking node workDir = file("${project.buildDir}/nodejs") // Set the work directory for NPM npmWorkDir = file("${project.buildDir}/npm") // Set the work directory for Yarn yarnWorkDir = file("${project.buildDir}/yarn") // Set the work directory where node_modules should be located nodeModulesDir = file("${project.projectDir}") } 样式不适用于margin-bottom标记,如下图所示。标题和锚标记按钮之间的边距与<h1>指定的边距不同。是什么原因?

代码:

<h1>

See the overlapping buttons with heading's margin bottom

1 个答案:

答案 0 :(得分:0)

问题如下:

锚标记可用作按钮,但<a><button>不同。在这里,描绘margins <h1>的{​​{1}}的橙色荧光笔贴在<a>的文本顶部,而不是顶部边框,因为它周围有边框以使其看起来像一个按钮,但在语义上它不是一个按钮。

要显示差异,只需将<a>更改为<button>,因<margin-bottom> <h1>而向下移动。

enter image description here

修改:来自UncaughtTypeError用户的评论。

问题实际上与所讨论的按钮的显示类型属性有关,默认情况下,锚标记元素(a)被计算为display:inline,这应该更新为显示:inline-block to attribute block type properties to the元素(如边际值)。