We should include this in system.base.css. All core themes will need it and modules may as well.

CommentFileSizeAuthor
#1 html5-display-1321678-01.patch602 bytesJacine
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jacine’s picture

Status: Active » Needs review
FileSize
602 bytes

Here's a patch.

JohnAlbin’s picture

Status: Needs review » Needs work

Note that "block-level" is only defined in HTML4 and is not defined for HTML5. The best description of what "block-level" roughly means for HTML5 is here: https://developer.mozilla.org/en/HTML/Block-level_elements

That page shows that these are the new HTML5 elements that need CSS block styling: article, aside, audio, canvas, figcaption, figure, footer, header, hgroup, output, section, video

It took me a little digging, but it looks like Jacine's patch is based on the elements at http://html5doctor.com/html-5-reset-stylesheet/ Which is a 2009 article.

I'm also looking at the internals of the html5 shim to see what elements it inserts, but it does so for block and inline elements, so I haven't whittled it down to a list of block-level elements yet.

Jacine’s picture

I did find references to "block-level" elements in the spec when I was looking into this, but maybe I was looking at an older version because I cannot find them anymore. I didn't get the list from a 2009 article though. ;)

The idea here is to reset the default UA styles. The list is the same as what is currently defined in both Compass and Normalize.css, which is used in the HTML5 Boilerplate project. I'll pull the pages from the spec to confirm this and post.

One thing I didn't add, which I wanted to talk about is the inline-block elements. I'm not sure whether we should add those or not.

Jacine’s picture

Here's the source of the display: block recommendations. It's in the rendering section of the spec: http://dev.w3.org/html5/spec/Overview.html#rendering

The entire list of new elements is here:

section, article, aside, hgroup, header, footer, menu, nav, figure, figcaption, video, audio, source, track, mark, progress, meter, time, ruby, rt, rp, bdi, wbr, canvas, command, details, summary, datalist, keygen, output

This patch covers:

section, article, aside, hgroup, header, footer, menu, nav, figure, figcaption, details, summary

That leaves:

video, audio, source, track, mark, progress, meter, time, ruby, rt, rp, bdi, wbr, canvas, command, datalist, keygen, output.

Of the remaining list, the only ones in question are canvas, video and audio IMO, and those are the ones that normalize.css sets as inline-block. I'm still looking into this, but my initial thought was to just leave this part out for now because we will likely not deal with these in core.

Still not sure what to call this instead of block-level elements though. Maybe I should just remove the heading in the comment?

JohnAlbin’s picture

Status: Needs work » Reviewed & tested by the community

Ok. Here's what I found. This is a list of all elements in HTML5: http://developers.whatwg.org/section-index.html#index Anything on that list that is "phrasing" means that tag can be used to markup intra-paragraph content”, i.e. its an inline element.

So if you look at the remaining list and whittle it down to only those new HTML5 elements, you end up with the exact list that Jacine has in her patch in #1. Nice job!

That leaves:

video, audio, source, track, mark, progress, meter, time, ruby, rt, rp, bdi, wbr, canvas, command, datalist, keygen, output.

Actually, no it doesn't. Those are all phrasing elements or are elements that can only appear inside specific elements that also happen to be phrasing elements.

Jacine’s picture

Sweet, thank you for looking into it too, John! :D

catch’s picture

Status: Reviewed & tested by the community » Fixed

Straightforward change. Committed/pushed to 8.x, thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.