Concatenate list hierarchy

Asked

Viewed 46 times

0

I have this html scenario in php.

<ul id="titulo1"></ul>
  <ul id="capitulo1"></ul> 
    <ul id="artigo1"></ul>
    <ul id="artigo2"></ul>

<ul id="titulo2"></ul>
   <ul id="artigo1"></ul>

I would like to add the hierarchy in the classes, to look like this

<ul id="titulo1"></ul>
  <ul id="titulo1_capitulo1"></ul> 
    <ul id="titulo1_capitulo1_artigo1"></ul>
    <ul id="titulo1_capitulo1_artigo2"></ul>

<ul id="titulo2"></ul>
   <ul id="titulo2_artigo1"></ul>
  • and what you’ve tried?

  • 1

    Why are you using Uls? in this case??? I don’t understand. Wouldn’t it be better to use H1, H2, H3, H4 and H5? This is already, by itself, hierarchical titles. including semantically understandable and recommended by W3C....

  • Because articles are usually divided into 3 arts, head, incisos and paragráfos, but sometimes in the incisos subitens as well. And in ul one can nest another ul inside it, which does not happen with headers. But I’m still not great at programming, if I’m wrong and there’s another smarter way to do it, I’d like to know.

  • related http://answall.com/a/82934/13561

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.