Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save CreatiCoding/54ab26b0c2f996e0557c1c0983310d80 to your computer and use it in GitHub Desktop.
Save CreatiCoding/54ab26b0c2f996e0557c1c0983310d80 to your computer and use it in GitHub Desktop.
HTML 대표적인 부모–자식 허용/금지 규칙
부모 요소 허용 자식 금지 자식
<p> 퍼징 콘텐츠 (텍스트, <span>, <a>, <em> 등) 블록 레벨/플로우 콘텐츠(예: <div>, <section>, <ul> 등)
<ul>/<ol> 직접적으로 <li> <div>, <p>, <span>
<li> 플로우 콘텐츠 (블록+퍼징) 없음 (사실상 거의 모든 흐름 콘텐츠 허용)
<dl> <dt>, <dd> 기타 모든 태그
<table> 선택적 <caption>, 0+<colgroup>, 0+<thead>/<tbody>/<tfoot> 순서 유지 <div>, <p> 등 직접 배치 금지
<thead>/<tbody>/<tfoot> <tr> <td>, <th>, <div> 직접 배치 금지
<tr> <th>, <td> <div>, <p>
<select> <option>, <optgroup> <div>, <span>, <p>
<optgroup> <option> <div>, <span>, <p>, <optgroup> 중첩 금지
<a> “투명 콘텐츠(transparen­t content)”—대체로 퍼징+임베디드 콘텐츠 다른 <a> (앵커 중첩 불가), <button>, <input> 등 인터랙티브
<button> 퍼징+임베디드 (텍스트, <span>, <img> 등) 또 다른 인터랙티브 콘텐츠(<button>, <a>)
<label> 퍼징 콘텐츠 + 폼 컨트롤(인풋) 없음 (대체로 자유롭게 텍스트+인풋 감싸기 가능)
<figure> 플로우 콘텐츠
<picture> <source>, <img> <div>, <p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment