Jump to content

unordered list replace bullet by image according to level, if last level text as


Peuplarchie

Recommended Posts

Good day to you all,

              I was wondering if there is a way to change the the look of wach level of a list.

 

Ex:

 

Last level, text = link

1st level, has 1 image instead of bullet and text in bold

2nd level as another image as bullet and text in bold

3rd level, if not last level, as another image as bullet and text in bold\

 

Here is where I'm now :

 


<html>
<head>
<style type="text/css">
ul {
      list-style-image: url(Icons/open_book_icon.jpg);
}

li {
      list-style-image: url(Icons/box_icon.png);
}


</style>
</head>
<body>



<?PHP
function globDir($dir)
{
   $files = glob("$dir/*", GLOB_ONLYDIR);
   
 if(!empty($files))
   {
      echo "<ul>\n";

      foreach($files as $file)
      {
         echo "<li><b>". basename($file)."</b>\n";
         globDir($file);
         echo "</li>\n";
      }
      echo "</ul>\n";
   }
}
globDir('Photos');
?>

</body>
</html>

 

Thanks !

How are you building the list. if its with a script the you know if its a sub-level. if so use ID's

<ul id=one>

<li>

<ul id=two>

<li>

</ul>

</ul>

 

#one ul

{ list-style-image: url(Icons/open_book_icon.jpg);}

 

#one li

{list-style-image: url(Icons/box1_icon.png);}

 

#two ul

{ list-style-image: url(Icons/closed_book_icon.jpg);}

 

#two li

{list-style-image: url(Icons/box2_icon.png);}

 

 

HTH

Teamatomic

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.