2013-12-17 69 views
1

我的h1标签,它是一个节标签insode,比h2标签小。标签外侧的h1标签尺寸正确。我一直在浏览我的CSS页面,并没有发现任何可以实现这一点的事情。这是我的CSS页面:h1标签小于h2,全部插入节标签

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; 
} 

任何帮助,将不胜感激

+0

我唯一的想法是它与'font:100%/ 1.4'行有关,也许浏览器对不同标签的处理方式不同? – arandompenguin

+0

发布整个html和css! –

+0

检查这两个元素,你会看到什么应用 –

回答

5

如果测试情况没有你的样式表,你会看到h1section元素出现在一个较小的字体。这是由支持section及其HTML5中的suggested rendering的浏览器中的浏览器样式表引起的。 section element已被定义为在其内部,h1元素是标题部分,因此相对于整个页面而言,它位于第2级(或甚至在较低级别,如果section元素已被嵌套)。

对于这种方法的适用性存在各种意见,但这正是HTML5草案所说的以及某些浏览器已实施的内容。另一方面,旧的浏览器忽略了这些规则,所以这种方法实际上并不稳健。这是更安全的(根据HTML5,完全可以接受)使用h2作为章节标题。