- From: bjartur <svartman95@gmail.com>
- Date: Fri, 04 Jun 2010 20:36:35 +0000
On 2010-06-04 rescator at emsai.net wrote: >On 2010-06-04 22:03, Tab Atkins Jr. wrote: >> No browser depends on you using the<body> element explicitly. It's >> perfectly fine to write your document like this: >> >> <!doctype html> >> <title>Test</title> >> <style> >> aside {border:1px solid #bf0000;white-space:nowrap;} >> </style> >> <aside> >> Just testing aside outside body! >> </aside> >> <article> >> Main part of article. >> </article> >> >> The<title> and<style> get auto-wrapped in a<head>, the<aside> and >> <article> get auto-wrapped in a<body>, and the whole thing below the >> doctype gets auto-wrapped in an<html>. > >Hmm! Intriguing. That is way cleaner than the "container" wrappers. >What browsers/engines behaves like that? >Does all HTML 4.01+ compliant browsers behave like this? As I understand it the opening and closing tags of the <html>, <head> and <body> elements are optional so that whenever content that belongs in one of those elements (such as text) is encountered it's automatically opened. Same as <p> elements get closed when block content is encountered (in HTML 4 that is). This is fully specified and documented and is in the DTD. This is valid HTML 4. is in fact a valid HTML file with an empty <head>.
Received on Friday, 4 June 2010 13:36:35 UTC