SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick question about repeating Divs?

    Hi

    Does anyone know if you are allowed to use the a div with the same ID name repeating across a page or does this cause problems because W3C pick it up as an error and I have noticed most eccomerce sites use a table with repeating td's inside a div container. I have already created a web page with a repeating div with the same id name so I am wondering whether I am doing it correctly??

    The product divs dont seem to layout correctly in firefox but do in all other browsers. The div I am repeating is div id="product-overview-container" and all the divs inside that div.

    http://www.locksandfittings.co.uk/products/subcat/43

  2. #2
    SitePoint Guru alecrust's Avatar
    Join Date
    Jun 2007
    Location
    London, UK
    Posts
    728
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should only have the same ID once in a page. Classes on the other hand can be used as many times as you wish on the same page.
    Honda Civic Forum - UK Civic Forum
    Web Host Reviews - Independent, honest host reviews
    My Portfolio - Simplicity is the ultimate sophistication

  3. #3
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have a look at the link i sent. What would be the best way of creating that div to use with a php loop for the products with the same div duplicating?

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are 120 validation errors on that page. If you were to serve this as real XHTML, all you'd see would be an error message.

    You should always make sure your markup is valid before you start looking for presentational problems. Invalid markup means anything can happen, since error handling is not standardised (except for real XHTML and other applications of XML, where it's draconian).

    And unless you can guarantee well-formed markup you really should be using an XHTML doctype declaration (even if you're serving it as text/html).
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •