Block Elements

The two main types of elements are block and inline.

 

Block elements:

  • Only appear within the <body> element
  • Formatted with a line break before and after the element
    • Start and end on a new line
    • Thus creating a block of content
  • May contain inline and other block level elements

 

Example showing one heading and three paragraph block level elements:

<!DOCTYPE html>
<html>
	<head>
		<title>My Document Title</title>
	</head>
	<body>
		<h1>My first Heading</h1>
		<p>Paragraph one</p>
		<p>Paragraph two</p>
		<p>Paragraph three</p>
	</body>
</html>

Save & refresh browser:

 

*note: the above diagram is representational of the four blocks. A browser rendered view would not have the block outlines or blue shaded body.

Leave a Reply