.NET프로그래밍/CSS 2.0

6. 스타일시트에서의 우선순위

holland14 2009. 7. 27. 23:22

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
       <title>스타일시트에서의 우선순위</title>
       <style type="text/css">
       div { color:Green; }

       .yellowText { color:Yellow; }
       #redText { color:Red; }
       </style>
       <link rel="Stylesheet" type="text/css" href="StyleSheet.css" />
</head>
<body>
      <div class="yellowText" id="redText" style="color:Teal;">
          안녕하세요

      </div>

</body>
</html>


<!--
- 스타일시트에서 여러 속성 및 태그들이 중첩될 경우 우선순위로 적용되는 것은 태그사이에 있는 본문과 가장 가까운 속성이 우선 적용된다.

우선순위 : 기본은 가까운 것...
style속성 > id속성 > class속성 > (style태그 > link태그)
-->


< 실행결과 >