Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Nesting Elements and Comments | Basics Introduction
Introduction to HTML
course content

Course Content

Introduction to HTML

Nesting Elements and Comments

Block-level Elements

Block-level elements are those that, when used in an HTML code, is displayed by the browser on another line, and they have a certain margin around them that separates them from other elements around them.

html

index

css

index

js

index

Inline Elements

Inline elements don't start on a new line and don't have any margin around them.

html

index

css

index

js

index

Note

span is an inline markup element holding no specific meaning in the markup but used as a convenient representation of any inline area that you want specifically styled or behave differently.

Nesting Elements

As shown in the above example of inline elements, the element span is nested within the p element. Some elements can be added to other elements.

  • Both block and inline elements can be nested inside block elements;
  • Inline element can be nested inside the block and inline element;
  • Block element cannot be nested inside an inline element.

Comments

Comments help record what is happening in the code. This can be useful when you look at your code after some time. Also, it's helpful for another developer to know what happens with each code block when he inspects your code.

html

index

css

index

js

index

  • <b> is an inline element used to bolden part of the text in the document;
  • <em> is an inline element used to emphasize part of the text in the document.

Task

  1. Add tags needed.
  2. Add your name.
  3. Bold and italicize text.

Everything was clear?

Section 1. Chapter 4
We're sorry to hear that something went wrong. What happened?
some-alt