HTML CSS

dl, dt, dd 태그 사용 시 css를 먹히고 싶을 때 바꿀 수 잇는 방법

sj0020 2021. 8. 16. 22:24

dl 태그 내부에는 dt와 dd 만 올 수 있고 이외의 태그는 넣지 못한다.

그런데 만약 내부의 css를 수정하고 싶다면 어떻게 해야되느냐? (예를들어 하나의 dt dd 묶음에 div를 주ㅓ서  css 를 주고싶다고 칠 때 !)

아래처럼 dl 태그 말고 li dfn p 태그를 쓰는걸로 바꾸면 된다.

<body> 
  <dl>
    <dt>Coffee</dt>
    <dd>Coffee is a brewed drink prepared from roasted coffee beans, the seeds of berries from certain Coffea species.</dd>
    <dt>Milk</dt>
    <dd>Milk is a nutrient-rich, white liquid food produced by the mammary glands of mammals.</dd>
  </dl>

  <ul>
    <li>
        <!-- definition 태그 -->
        <dfn>
          Coffee
        </dfn>
        <p>Coffee is a brewed drink prepared from roasted coffee beans, the seeds of berries from certain Coffea species.</p>
    </li>
  </ul>

</body>