HTML5 P and UL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HTML5 P and UL

Pol Briand
(form in http://www.w3.org/TR/html5/ sent me to page reading
"Because of how we filter for spam, you need to enable JavaScript to
use this form, sorry." though js is enabled (and tested) on my Firefox 3.6.12
for OpenSuse 11.1)

Concerns: The ul element, The p element

Semantically, paragraphs (P elements) may contain one or several LIST (UL or
OL elements). It is a question of context to display them as, for instance

+ lines identified with bullets, the original way

+ in-line comma-separated lists for a more compact appearance (maybe in print
or on cell phone displays); the whole list may be in brackets.

---

There are two issues about this:

+ The spec must accept UL and OL within P. The list is generally really part
of the paragraph.

+ In the case of the comma-separated list, the CSS determines the separator.
The comma comes after the li element, for all but the last. A last-child
selector would do better than the current workaround, li:before {content:", "}
li:first-child:before {content:""}. With this code, one must leave no
whitespace between the li elements and between the li opening tag and the
element content, if the comma is to stick where it must. The encoding is ugly
and editing (for instance changing the order or include/suppress list items)
prone to errors.
--
-------------
Pol Briand
3. rue de la Palestine
F-75019 Paris France
(33) 142 396 436


Reply | Threaded
Open this post in threaded view
|

Re: HTML5 P and UL

Jukka K. Korpela-2
Pol Briand wrote:

> Semantically, paragraphs (P elements) may contain one or several LIST
> (UL or OL elements).

That's more about syntax than about semantics, and whether a paragraph may
contain lists is debatable, at a general level of discussion as opposite to
HTML specifically. In HTML, it has always been a rule that a <p> eleement
may contain "text-level" or "inline" or "phrasing" content only - no <ul> or
<ol> elements for example.

If you are suggesting that HTML should be modified to allow lists inside
<p>, then I'm afraid the suggestion has no hope of being accepted. The main
reason is that such a change would break existing pages.

In HTML as currently defined, if you have, say,

<p>foobar<ul>

then a browser is required to infer a missing </p> before the <ul> tag, i.e.
an <ul> element implicitly closes an open <p> element. This is because <ul>
is not allowed inside <p> and the <p> element is defined as having an
optional closing. If <ul> were allowed inside <p>, then where would the <p>
element end?

It would be a different thing to prose a "superparagraph" element that may
contain lists and perhaps other block contents as well, such as a
blockquote, a pre element, or a table. I don't think it would be very
realistic either (there's hardly any practical necessity for such an
element, and practical benefits are more or less debatable), but it would
have better chances than an essential change to an existing element.

--
Yucca, http://www.cs.tut.fi/~jkorpela/ 


Reply | Threaded
Open this post in threaded view
|

Re: HTML5 P and UL

ownedthx
Or make a new list tag definition that is inline-only and therefore can be used in <p>.

(discussions such of these make me wish I could just use something like docbook or dita within HTML, because really an incremental patch such as this just continues to highlight how difficult it is to represent structured text with just HTML and that fuller implementations already exist).

Seth

On Mon, Apr 25, 2011 at 6:51 AM, Jukka K. Korpela <[hidden email]> wrote:
Pol Briand wrote:

Semantically, paragraphs (P elements) may contain one or several LIST
(UL or OL elements).

That's more about syntax than about semantics, and whether a paragraph may contain lists is debatable, at a general level of discussion as opposite to HTML specifically. In HTML, it has always been a rule that a <p> eleement may contain "text-level" or "inline" or "phrasing" content only - no <ul> or <ol> elements for example.

If you are suggesting that HTML should be modified to allow lists inside <p>, then I'm afraid the suggestion has no hope of being accepted. The main reason is that such a change would break existing pages.

In HTML as currently defined, if you have, say,

<p>foobar<ul>

then a browser is required to infer a missing </p> before the <ul> tag, i.e. an <ul> element implicitly closes an open <p> element. This is because <ul> is not allowed inside <p> and the <p> element is defined as having an optional closing. If <ul> were allowed inside <p>, then where would the <p> element end?

It would be a different thing to prose a "superparagraph" element that may contain lists and perhaps other block contents as well, such as a blockquote, a pre element, or a table. I don't think it would be very realistic either (there's hardly any practical necessity for such an element, and practical benefits are more or less debatable), but it would have better chances than an essential change to an existing element.

--
Yucca, http://www.cs.tut.fi/~jkorpela/