HTML5, CSS3, and JavaScript Fourth Edition

(Ben Green) #1

CHAPTER 4. HTML TAGS AND ATTRIBUTES 39


4.2.2 Some Tags Stand Alone (Void)


The other kind uses a single tag and does not surround any text. These are
calledvoid tags.


Instead of marking up the existing content, void tags insert additional con-
tent, such as an image or a line break.


These are some commonly-used void tags: base, br, hr, img, input, link,
meta.


Check out this picture:


4.2.3 Starting and Ending a Tag


Exam Question 54(p.339):What character marks the start of each piece
of HTML markup?
Required Answer:<


Exam Question 55(p.339):What character marks the end of each piece
of HTML markup?
Required Answer:>


Exam Question 56(p.339): What two characters can mark the end of
HTML markup for a void tag?
Required Answer:/>


Some authors strongly recommend using/>at the end of each void tag. I
don’t believe that any more.


Exam Question 57(p.339):When a tag is void, what does that mean?
Acceptable Answer:it cannot have a separate end tag


Exam Question 58(p.339):When do you need a space before the end of
HTML markup?
Acceptable Answer:If the markup ends in />and a non-quoted attribute
value is right before it.


The reason you need a space between a non-quoted attribute value and />
is to avoid having the / wrongly accepted as part of the attribute value.

Free download pdf