【问题标题】:H1 tag special designH1标签特殊设计
【发布时间】:2018-12-18 06:07:40
【问题描述】:

我花了几个小时寻找我的问题的答案,但没有找到类似的东西。我已经完成了很多设计的网页。现在我注意到我没有在任何页面上使用 H1 标签,而是希望在导航标题上添加 H1 标签。

所以我的问题是,

如何让H1标签没有任何效果,只是成为HTML中的普通标签,对文本没有样式影响?

【问题讨论】:

标签: html css tags


【解决方案1】:

使用all: unset; 删除默认浏览器样式(然后您可以根据需要设置样式...)

h1{
 all: unset;
}
<h1>I am h1 but looks like normal p</h1>

IE 中的编辑支持

您的替代方法是使用 !important 覆盖浏览器默认样式

here is links to default style in each browser

例如覆盖 IE 样式:

h1{
font-size: 11pt;
font-weight: normal;
}
 <h1>I am h1 but looks like normal p</h1>
 
 <p>this is the default style:</p>
 display: block;
font-size: 24pt;
font-weight: bold;
margin: 14pt 0;

【讨论】:

  • 谢谢,它起到了作用,但我必须在最后添加 !important。但是如何为 Edge/Internet Explorer 做同样的事情呢?
【解决方案2】:

按照您为其他标签声明的方式重新分配 h1 标签样式。 h1{font-size:20px !important;.....}

【讨论】:

    【解决方案3】:

    您可以将 h1 标签用于主标题并根据您的要求进行自定义。喜欢:-

    h1{font-size: 24px;}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-07
      相关资源
      最近更新 更多