Do tags themselves count as content?


#1

Question

In this example, do the <p> tags also count as content or is the content just the sentence contained within the tags?

Answer

The content is just the information contained within the tags themselves. The tags are marking up this content so that the browser knows how to properly interpret and structure this information. As you will learn later in this lesson, the content is not always contained within an opening and closing tag. For example, the <img> tag is an example of a self-closing tag and it introduces content into the page differently than the <p> element.


FAQ: Learn HTML Elements - Intro to HTML - HTML Anatomy
#3

should be than not then


#4

Thank you for pointing that out. Fixed.


#5

can someone tell me if this is right so the < p > element can only contain text or can it contain images too? and also it said it the last question that tags like images can’t contain content at all is this because after you finish your content you use the < IMG > to finish the content off? thanks guys in advance


#6

A paragraph may contain any inline level element. B, I, STRONG, EM, SPAN, INPUT, BR, HR and IMG are among such elements. (Check up on BR and HR as to whether block or inline.)

In the old days we used to have an unwritten rule… “No inline elements in the BODY.” That means an IMG would necessarily be contained in either a DIV, an LI or a P. I still recommend containing images, even if this rule is flouted in present day.

An IMG element is known as a void element since it is not a content container. It’s content is written to attributes on the element. For IMG, this would be the src, title and alt attributes.