2012-02-15 5 views
1

'font-weight'속성을 재정의하는 CSS에 이상한 문제가 있습니다. 다음은이 문제를 나타내는 코드입니다. -'font-weight'속성에 대한 CSS 덮어 쓰기

요소 'p'의 'font-weight'가 작게 설정되었습니다 (같은 방식으로 색상이 자주색으로 설정 됨). 그러나 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