2013-12-17 71 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作爲章節標題。