Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are perfectly free to do any of the following:</p> <ul> <li>add a <code>class</code> or <code>id</code> attribute to the <code>body</code> element;</li> <li>directly apply CSS to the <code>body</code> element, with or without <code>class</code> or <code>id</code> attributes; or</li> <li>directly apply CSS to the <code>html</code> element, although <em>without</em> the <code>class</code> or <code>id</code> attributes and with <a href="https://stackoverflow.com/questions/4565942/should-global-css-styles-be-set-on-the-html-element-or-the-body-element">some important caveats</a>.</li> </ul> <p>Any of these are perfectly legitimate uses of CSS and HTML.</p> <p>Why <code>&lt;div id="container"/></code>? Through the years, many CSS techniques have employed arbitrary container elements for conceptual simplicity, to avoid certain cross-browser inconsistencies or because they were simply too complex to be achieved otherwise. A couple of more subtle reasons include that in older browsers, one could not apply CSS to the <code>html</code> element directly, and there were (and are) certain unusual or restricted properties for those elements—often for <a href="http://www.mail-archive.com/dev-tech-layout@lists.mozilla.org/msg01520.html" rel="nofollow noreferrer">obvious reasons</a>. (They were <a href="http://lists.w3.org/Archives/Public/www-style/2007Mar/0035.html" rel="nofollow noreferrer">sometimes described as being "magic"</a> for this reason.)</p> <p>These all conspired to create a situation where to achieve almost any moderately complex layout, it was inevitably much easier to just start out with a squeaky-clean container element. Though the practice started as a means to an end it soon became just part of the scenery, and now many developers don't think twice about adding that sprinkling of extra markup.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload