태그를 사용하면 HTML 문서의 섹션을 쉽게 정의할 수 있습니다. HTML 요소의 큰 섹션을 함께 그룹화하고 쉽게 서식을 지정합니다.
태그는 블록 수준 요소와 함께 사용됩니다.
다음 코드를 실행하여
태그를 사용하여 HTML 요소의 스타일을 지정할 수 있습니다. 추가된 스타일 규칙은 id=”content”인 요소에 적용됩니다.
여기 id는 CSS 선택기입니다.
여기 id는 CSS 선택기입니다.
예시
<!DOCTYPE html> <html> <head> <title>HTML div Tag</title> <link rel = "stylesheet" href = "style.css"> </head> <body> <div id = "container"> <p>Welcome to our website. We provide tutorials on various subjects.</p> </div> </body> </html>
여기 CSS 파일 style.css가 있습니다.
#container p { line-height: 15px; margin: 20px; padding-bottom: 15px; text-align: justify; width: 130px; color: blue; }