The class attribute not only gives a clear meaning to both elements but also allows
CSS to access these elements for formatting purposes—but m ore on th at later.
Mike: T here’s one more qu estion bothering me. I have found an element for writing
unordered lists (<u l>) and I’m not quite sure whether I shou ld put it inside a paragraph
or not. A list, in my opinion , is a part of a paragraph but visually it is represented as
a separate blo ck. I know that I am mix ing two concepts, which you’ve just cle arly
separated, but in this case my thinking is a bit blurred.
Professor: I a gree that it is a matter of debate whether a list is a separate pa ragraph
or not. In p ractice, things are sometimes not as clear as in theory. Lu ckily, in this
special case we have recourse to the additional rules concerning context in which
certain HTML elemen ts can appear, and the content that they are allowed to include.
One or both of the terms also appear with some of the element descr iptions in the
concise reference at the end of this boo k. For example, you will find that the <p>
element should only contain text and inline elements. Because the <ul> eleme nt is a
block element, you shouldn’t put it inside a <p> element.
Mike: You have already told us about the block-inline categorization of elements
based o n their default display setting, but I’m still confused. When y ou are talking
about display, isn’t that presentation?
Professor: You couldn’t be more right about tha t. In HTML5, a disp la y has be-
come purely a CSS term since it define s the visual behavior of an element. In the
past, the categorization of bloc k and inline elements helped auth ors in deciding which
element is allowed a s a c ontent (descendant) of the other. In HTML5, this binary cat-
egorization has been replaced by a more complex one and you will hear terms like
the flow content, sectioning content, phrasing content, and so on. If you are inter-
ested in studying these (which I don’t actually recomm end at this stage), I sug gest
that you visit the site
developer.mozilla.org, which is written on a higher technica l
level than
www.w3schools.com, but still more understandable fo r a beginner than the
World Wide Web Consortium’s (W3C) page,
www.w3.org , which publishes original
web stand ards and is quite a demand ing read.
To keep things simple, some authors equate the flow content category roughly with
the block displa y category and the phrasing content category roughly with the inline
display ca tego ry. This block-inline categorization is easier to und erstand. That’s wh y
it is still used by some authors.
As a rule of thumb, an inline element can only conta in inline elements while a block
element can contain inline elements as well as block elements. A notable exception
to the rule are elements <p> and <h1> to <h6>, which are block elements but cannot
contain block elements. Again , when in doubt, you can use an HTML validator.
OK, that’s it. He re is a possible final solution of your ho mework:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
2.1. Homework Discussion 17