FAQ: Learn HTML - Intro to HTML - The Body

You can add images using the (self-closing) <img /> tag and videos using the <video> tag.
You can also reference CSS files in the <head> using the (self-closing) <link> tag and JavaScript files using the <script> tag.
And finally, you can have an <input> tag with the type attribute equal to "file", although that is meant for the user to insert a file.

You’ll learn more about these further in the course.

Hi! Completely new to coding with very minimal knowledge and understanding of HTML. My question is - is there a reason why some lines have pre-set spacings? For example on the exercise under this section, lines 2 (before '

) and 3 (before ‘’ have double spacings each.

In addition to this, is it important to have these double spacings? If so, what is the right number of spacings are we meant to have?

Thank you in advance.

You’ll still be new to code since HTML is not really considered, ‘coding’. It is markup which is done exclusively by the document author in a completely declarative setting. We, the designer provide the logic and reasoning in how we assemble a page in terms of content placement (structure) and styling (appearance).

That said, just so you know you are the boss when it comes to HTML, consider also that HTML ignores white space (spaces and hard returns/line breaks).

    This is a paragraph 
        containing white 

Will render as though we had marked it up as,

<p>This is a paragraph with no added white space</p>

HTML sees the tags and the content, and that is all. If we have a line,

<p>The line below
is rendered alongside, not below</p>

will have an inserted space character when the two lines are joined. That means a newline is treated as a single space.

Now to answer your question as I understand it, are you referring to indentation?



      <h2>section headline</h2>
      <p>Lorem ipsum&hellip;</p>


If that is your question then think of the indented form as being a guide to the structure and parent child relationship of the contained elements. Authors do this so they can keep track of nesting and when we get to CSS, of inheritance. The indentation is there strictly for the reader/author and has no meaning to HTML whatsoever.

1 Like

why is it giving me a number before the body for instance, 1

Are you referring to a line number in your editor?

have done the test but am not still passing it
is body and paragraph element working together ?
do i need to add paragraph to body element?

Let’s pretend you have a nice new sheet of A5 paper in front of you. It’s crisp and clean, and blank. Analogously we can refer to this as the BODY of the document. It’s where we put stuff we want the reader to see and read.

The blank paper is the root, per se of our document, notwithstanding the role of HTML. Focusing on the blank page is the aim, here. What we place there will be child elements of the BODY.

Use that blank piece of paper to sketch what your user will see in a rough layout. Notice how you immediately section off the page for this and that? HTML uses sectioning elements in the same way. It’s intuitive when you get past the jargon.

Always go back to the blank sheet of paper, a well crafted outline, and a decent sketch of the layout and organization and fill in the gaps with HTML. It really is that simple, when you get past the jargon.

1 Like

Is the body tag indicating the body of the website and paragraph tag indicating paragraph

We have a blank sheet of paper we wish to render as a transmitted document that can be deciphered on the other end. If you really want to get to the bottom of your question, research the early days of the network, and really drill into the early internet.

Unless we understand what our goal is, the mechanics of achieving it are meaningless.

1 Like