html - eric meyer 的 css 重置影响标题

标签 html css

我正在使用 Eric Meyer 的 css reset 2。但是在我的网站中使用标题时,标题都是相同大小和小文本。我已经看到问题来自 css reset。我尝试从那里删除标题,但现在它们似乎从顶部开始填充。这是一个 fiddle 示例:jsfiddle.net/50c9dsyu/。

h1 {
  color: gray; }
/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <link href="sass\main.css" rel="stylesheet"/>
    <link href="css\reset.css" rel="stylesheet"/>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
  <h1>I like pizza</h1>
</body>
</html>

最佳答案

正如评论中所指出的,这是任何 CSS 重置的预期行为。您添加的任何 CSS 都需要低于重置规则。我已经更新了你的 fiddle 。

/* Reset code goes here */

.myRule { 
    color: red;
}

http://jsfiddle.net/50c9dsyu/2/

注意 H1 的规则现在位于 CSS 的底部。

关于html - eric meyer 的 css 重置影响标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39147198/

相关文章:

jquery - 使用 jQuery 覆盖 CSS 条件规则

jquery - CSS jQuery Dropline Menu - 如何使第一行 33px?

javascript - 我的 JavaScript 小部件中的 css 与目标页面 css 冲突

jquery - removeClass() 何时在窗口中?

html - 停止 float div 换行

php - 我无法从 php 中的链接中找到数据

html - css 使 tbody 与表格大小相同

javascript - JVectorMap 设置比例低于 1

html - Google 字体特殊字符在 PC 上显示正确,但在 HTML 中却无法显示?

jquery - 在不断变化的背景上随机放置的单词(链接)