Create a working HTML/CSS for the following nested list format?

list

Leaf nodes should be green, Parent nodes should be bold red, Root should be like parent with underlined

Just Born Asked on December 23, 2015 in HTML and CSS,   Web Designing.
Add Comment
  • 1 Answer(s)

      HTML Code

      
      <!DOCTYPE html>
      
      <html>
      
      <head>
      
      <title>List</title>
      
      <link href="stylesheet.css" rel="stylesheet" type="text/css" />
      
      </head>
      
      <body>
      
      <div class="list">
      
      <ul id="root">
      
      <li>Root</li>
      
      <ul id="child">
      
      <li>Child1</li>
      
      <ul id="subchild">
      
      <li>Child11</li>
      
      </ul>
      
      <li>Child2</li>
      
      <ul id="subchild">
      
      <li>Child21</li>
      
      <li>Child22</li>
      
      </ul>
      
      <li>Child3</li>
      
      <ul id="subchild">
      
      <li>Child31</li>
      
      </ul>
      
      </ul>
      
      </ul>
      
      </div>
      </body>
      
      </html>
      

      CSS Code

      
      #root li{
      
      font-weight::bold;
      
      font-family:Arial, Helvetica, sans-serif;
      
      color:red;
      
      text-decoration:underline;
      
      font-size:18px;
      
      }
      
      #child li{
      
      font-weight::bold;
      
      font-family:Arial, Helvetica, sans-serif;
      
      color:red;
      
      text-decoration:none;
      
      font-size:14px;
      
      }
      
      #subchild li{
      font-weight::bold;
      
      font-family:Arial, Helvetica, sans-serif;
      
      color:green;
      
      text-decoration:none;
      
      font-size:12px;
      
      }
      

      Just Born Answered on December 23, 2015.
      Add Comment

      Your Answer

      By posting your answer, you agree to the privacy policy and terms of service.