h1标签小于h2,都是insde一个section标签

 浪子得意_357 发布于 2023-02-09 18:37

我的h1标签是insode的一个标签,比h2标签小.当在section标签外面时,h1标签的大小正确.我一直在浏览我的CSS页面,但没有发现会导致这种情况发生的事情.这是我的CSS页面:

body 
{
    font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
    background-color: #42413C;
    margin: 0;
    padding: 0;
    color: #000;
    background-image: url(images/mass_effect_1_citadel_dreamscene_by_droot1986-d5sw7hu.jpg);
}

a img 
{
    border: none;
}

.container 
{
    width: 960px;
    background-color: #192370;
    margin: 0 auto;
}

header 
{
    background-color: #050a2e;
}

.sidebar1 
{
    float: left;
    width: 175px;
    background-color: #2236d1;
    padding-bottom: 10px;
    border: solid thin black;
    text-align: center;
}

.content 
{
    padding: 10px 0;
    width: 780px;
    float: right;
    border: solid thin black;
}

footer 
{
    padding: 10px 0;
    background-color: #050a2e;
    position: relative;
    clear: both;
    text-align: center;
}

header, section, footer, aside, article, figure 
{
    display: block;
    color: white;
}

a:link
{
    text-decoration: none;
    color: #d1bd22;
    font-size: 1.3em;
}

a:visited
{
    text-decoration: none;
    color: white;
    font-size: 1.3em;
}

a:hover
{
    text-decoration: underline;
    color: #d1bd22;
    font-size: 1.3em;
}

a:active
{
    text-decoration: underline;
    color: white;
    font-size: 1.3em;
}

任何帮助将不胜感激

1 个回答
  • 如果在没有样式表的情况下测试情况,您将看到元素h1内部section以较小的字体显示.这是由浏览器样式表引起的,支持的浏览器section及其在HTML5中的建议呈现.的section元件已被定义,使得在其内,一个h1元件是一个标题的部分,所以相对于页面作为一个整体,它是在第2电平(或甚至在一个较低的水平,如果section内容已经嵌套).

    对于这种方法的充分性有各种各样的看法,但这就是HTML5草案所说的以及一些浏览器已经实现的内容.另一方面,旧浏览器忽略了这些规则,因此该方法实际上并不健壮.h2用于章节标题更安全(并且根据HTML5完全可以接受).

    2023-02-09 18:42 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有