html - html 标题标签(<h1>、<h2>、<h3> 等)的默认边距是多少?

标签 html css

我避免将默认值与以下重置代码一起使用:

margin:0px; and padding:0px;

例如,下面标题标签的默认边距是多少?

<h1>Header</h1>

最佳答案

对于哪个浏览器来说是不同的,因此如果你想要一个像素完美的设计那么实践是将这些值“重置”为 0(边距和填充)并自己设置它们。

“CSS 重置”对于前端开发人员来说很常见,我使用的一个简单示例:

html,body,blockquote,code,h1,h2,h3,h4,h5,h6,p,pre{margin:0;padding:0}
button,fieldset,form,input,legend,textarea,select{margin:0;padding:0}
fieldset{border:0}
a,a *{cursor:pointer}
div{margin:0;padding:0;background-color:transparent;text-align:left}
hr,img{border:0}
applet,iframe,object{border:0;margin:0;padding:0}
button,input[type=button],input[type=image],input[type=reset],input[type=submit],label{cursor:pointer;}
ul,li{list-style:none;margin:0;padding:0;}
strong{font-weight:bold;}
em{font-style:italic;} 

关于html - html 标题标签(<h1>、<h2>、<h3> 等)的默认边距是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55911799/

相关文章:

IE11 中的 HTML 选择菜单问题

jquery - 如何在 Rails 中创建级联菜单?

css - IE 不按照 css 文件显示图像

html - Internet Explorer 10 忽略 css <a> 字体颜色

javascript - 如何从文档片段中获取实际元素?

javascript - 更改按钮的背景颜色(开/关)

html - 将没有 class 或 id 的 li 中的文本右对齐

html - 我想将我的 UL 居中,但它不起作用

Jquery show div based on another div's visibility and checked value

javascript - 如何在 Angular 中使用 CSS 相邻兄弟选择器?