HTML and CSS Reference
In-Depth Information
Listing 3-27. Block vs. Inline Elements
<div>
<h1>Attention</h1>
<p>View our <em>special offers</em> now!</p>
</div>
Most HTML elements that can be used within the document body are classified as either block-level elements or
inline elements. There are some elements that can be used in both contexts (such as buttons, objects, and scripts).
Block-Level Elements
The following elements are handled as block-level elements in HTML5: article , aside , blockcode , blockquote , body ,
button , canvas , caption , col , colgroup , dd , div , dl , dt , embed , fieldset , figcaption , figure , footer , form , h1 , h2 ,
h3 , h4 , h5 , h6 , header , hr , li , map , object , ol , output , p , pre , progress , section , table , tbody , textarea , td , tfoot , th ,
thead , tr , ul , and video .
Inline Elements
Generally, inline elements can contain text or other inline elements only. They are usually rendered within the current
line. The inline elements of HTML5 are a , abbr , address , area , b , cite , code , del , details , dfn , datalist , em , font , i ,
iframe , img , input , ins , kbd , label , legend , link , mark , meter , nav , optgroup , option , q , samp , small , select , source ,
span , strong , sub , summary , sup , textarea , tt , u , time , and var .
Elements That Can Be Either Block or Inline Elements
Elements such as button , del , iframe , ins , map , object , and script can be used as either block-level elements or
inline elements. If used as inline elements (e.g., within another inline element or a paragraph), these elements should
not contain any block-level elements.
Attributes
The HTML5 element attributes are summarized in Table 3-8 [41].
 
Search WWH ::




Custom Search