0

I have a collection of fairly large page elements which, when clicked, slide out and slide in new elements. It would be nice to use <a> tags to link the elements together, but unfortunately the content inside each element can't be expressed solely in <span>s and other content-level elements, so I have to use a <div> as the clickable element.

What is the best way to specify the relations between the elements using a <div> or similar?

I could do something like:

<div id="attribute-1" rel="{href: '#subattribute-1'}">Details about subattribute 1</div>

and parse the rel element into Javascript. But using the rel element like that feels hacky; is there a better solution that I'm missing?

Thanks, Kevin

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
  • Not sure what you mean by "What is the best way to specify the relations between the elements using a
    or similar?"? What do you mean by "relations"?
    – jamesmortensen May 18 '12 at 03:02

1 Answers1

3

You could use data-* attributes. Like data-target. Or you could wrap the div in an a (valid in HTML5)

Tom Pietrosanti
  • 4,184
  • 2
  • 24
  • 29