2012-02-15 12 views
1

'font-weight'プロパティをオーバーライドするCSSに奇妙な問題があります。 -'font-weight'プロパティのCSSオーバーライド

要素 'p'の 'font-weight'がsmall(同じように紫色に設定されている)に設定されています。しかし、FF/Chromeではフォントが太字で表示され、色は紫色に優先されます。

これはなぜ起こっているのですか?

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8"/> 
     <style type="text/css"> 
     p { 
      font-weight: small; 
      color: purple; 
     } 
     #speciality_test{ 
      font-weight: bold; 
      color: red; 
     } 
     .class_speciality_test{ 
      font-weight: bold; 
      color: red; 
     } 
     </style> 
    </head> 

    <body> 
     <div id="speciality_test"> 
      <p> 
       Inside identifier... HTML CSS test pages. 
      </p> 
     </div> 
     <div class="class_speciality_test"> 
      <p> 
       Inside class... HTML CSS test pages.  
      </p> 
     </div> 
    </body> 
</html> 

答えて

1

smallは有効な値ですか? W3Cによると、normal,bold,bolder,lighter,inheritまたは数字のいずれかである必要があります。

1

小さいとは思いません。

font-weight: normal; 

、私は私の知る限りでは、作業

1

で使用するものですsmallはあなたの例ではそうfont-weight

font-weight: { 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | bold | bolder | lighter | normal | inherit } ; 

のための有効な値ではありません、#speciality_testからフォントの太さ使用されている。

Sitepoint reference

関連する問題