Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is wrong with this HTML5 <address> element?

<div id="header-container">
      <address>
        <ul>
            <li>lorem ipsum</li>
            <li>(xxx) xxx-xxxx</li>
        </ul>
    </address>
</div>

And the CSS looks like this:

#header-container address {float: right; margin-top: 25px;}

When I load the page, it looks fine in Chrome & IE, but in Firefox it's ignoring the styling completely. When I view source in firefox it looks like above, but in Firebug it looks like this:

<div id="header-container">
    <address> </address>
    <ul>
         <li>lorem ipsum</li>
         <li>(xxx) xxx-xxxx</li>
    </ul>
</div>
like image 356
binaryorganic Avatar asked Feb 07 '11 15:02

binaryorganic


People also ask

What is the address element in HTML5?

The address element represents the contact information for its nearest article or body element ancestor. If that is the body element, then the contact information applies to the document as a whole.

Which is the wrong HTML5 tag?

Deprecated Attributes Some attributes from HTML4 are no longer allowed in HTML5 at all and they have been removed completely. img and iframe. caption, iframe, img, input, object, legend, table, hr, div, h1, h2, h3, h4, h5, h6, p, col, colgroup, tbody, td, tfoot, th, thead and tr. table, tr, td, th and body.

What is the work of address elements in HTML5?

The <address> HTML element indicates that the enclosed HTML provides contact information for a person or people, or for an organization.

Is address tag supported in HTML5?

HTML 5 <address> TagIf the tag applies to the body element, then it applies to the document as a whole. The <address> tag must not be used to represent arbitrary addresses (e.g. postal addresses), unless those addresses are contact information for the section. To display postal addresses, simply use the <p> tag.


1 Answers

HTML5 is still a draft. Firefox 3.6 doesn't completely support HTML5 yet.

And according to the HTML4 spec, address can only contain inline elements:

<!ELEMENT ADDRESS - - (%inline;)* -- information on author -->
<!ATTLIST ADDRESS
  %attrs;                              -- %coreattrs, %i18n, %events --
  >

This is why Firefox considers it invalid and your page breaks.

like image 101
dogbane Avatar answered Oct 23 '22 21:10

dogbane