HTML 요소 및 및 및 요소 간의 차이

1142 단어

HTML 요소
 <p> This is a block level, therefore, add padding and margin before and after the line</p>
 <p> This is single line sentence.</p>
<span>This is inline element and therefore does not add any padding and margin before and after the line.</span>
 <span>This is single line sentence.</span>

</body>

Result/ output


블록 레벨이므로 행 앞과 뒤에 채우기와 여백을 추가합니다.
이것은 한 마디다.
이것은 내부 요소이기 때문에 줄 앞뒤에 채우기와 여백을 추가하지 않습니다.이것은 한 마디다.

we can see that in case of the

element the result printed on two different line, however, in span the same code printed on the same line.
we actually use span element for styling purpose and it has not semantic meaning in html, however, the

element is block element and has semantic meaning in HTML

좋은 웹페이지 즐겨찾기