{"id":1000436,"date":"2007-03-07T13:26:37","date_gmt":"2007-03-07T18:26:37","guid":{"rendered":"http:\/\/www.elharo.com\/blog\/software-development\/web-development\/2007\/03\/07\/defining-block-level-elements\/"},"modified":"2007-03-07T13:28:14","modified_gmt":"2007-03-07T18:28:14","slug":"defining-block-level-elements","status":"publish","type":"post","link":"https:\/\/www.elharo.com\/blog\/software-development\/web-development\/2007\/03\/07\/defining-block-level-elements\/","title":{"rendered":"Defining Block Level Elements"},"content":{"rendered":"<p>I know what an HTML block level element is, but I&#8217;m damned if I can say it in a concise, correct, obvious way (which it so happens I need to do in Chapter 4 of <em>Refactoring HTML<\/em>). In HTML, block level elements include <code>p<\/code>, <code>blockquote<\/code>, <code>div<\/code>, <code>table<\/code>, <code>ul<\/code>, <code>ol<\/code>, <code>dl<\/code>, <code>h1<\/code>&#8211;<code>h6<\/code>, and a few others. Generally speaking a block element has a line break before and after it, but that&#8217;s really only true in a particualr visual representation. The notion of line breaks doesn&#8217;t make a lot of sense in a screen reader, for example.<\/p>\n<p>The HTML 4.0.1 specification defines block elements thusly:<\/p>\n<blockquote cite=\"http:\/\/www.w3.org\/TR\/html401\/struct\/global.html\"><p>Certain HTML elements that may appear in <a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/global.html#edef-BODY\" class=\"noxref\"><samp class=\"einst\">BODY<\/samp><\/a> are said to be <span class=\"index-def\" title=\"block-level::element|element::block-level\"><a name=\"didx-block-level\">&#8220;block-level&#8221;<\/a><\/span> while others are <span class=\"index-def\" title=\"inline::element|element::inline\"><a name=\"didx-inline\">&#8220;inline&#8221;<\/a><\/span> (also known as &#8220;text level&#8221;). The distinction is founded on<br \/>\nseveral notions:<\/p>\n<dl>\n<dt><strong>Content model<\/strong><\/dt>\n<dd>Generally, block-level elements may contain inline elements and other<br \/>\nblock-level elements. Generally, inline elements may contain only data and<br \/>\nother inline elements. Inherent in this structural distinction is the idea that<br \/>\nblock elements create &#8220;larger&#8221; structures than inline elements.<\/dd>\n<dt><strong>Formatting<\/strong><\/dt>\n<dd>By default, block-level elements are formatted differently than inline<br \/>\nelements. Generally, block-level elements begin on new lines, inline elements<br \/>\ndo not. For information about white space, line breaks, and block formatting,<br \/>\nplease consult the section on <a href=\"text.html\">text<\/a>.<\/dd>\n<dt><strong>Directionality<\/strong><\/dt>\n<dd>For technical reasons involving the <a rel=\"biblioentry\" href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/..\/references.html#ref-UNICODE\" class=\"normref\">[UNICODE]<\/a> bidirectional<br \/>\ntext algorithm, block-level and inline elements differ in how they inherit<br \/>\ndirectionality information. For details, see the section on <a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/dirlang.html#blocklevel-bidi\">inheritance of text direction<\/a>.<\/dd>\n<\/dl>\n<\/blockquote>\n<p>That&#8217;s not a great definition though. These seem more to be consequences rather than defining characteristics of block level elements.<\/p>\n<p>Can anyone offer a more precise definition of block element that does not presume a particular rendering? Just what is a block anyway? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know what an HTML block level element is, but I&#8217;m damned if I can say it in a concise, correct, obvious way (which it so happens I need to do in Chapter 4 of Refactoring HTML). In HTML, block level elements include p, blockquote, div, table, ul, ol, dl, h1&#8211;h6, and a few others. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[410],"class_list":["post-1000436","post","type-post","status-publish","format-standard","hentry","category-web-development","tag-flash"],"_links":{"self":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/1000436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/comments?post=1000436"}],"version-history":[{"count":0,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/1000436\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/media?parent=1000436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/categories?post=1000436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/tags?post=1000436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}