I am trying to make a vertical drop-down menu with sub-menus, for example:
1-
 1-
 2-
  1-
3- 
I've come up with the function below, but the CSS is not being applied even though it is defined on the page using the following:
<link href="estilo.css" rel="stylesheet" type="text/css" media="screen" />
What am I doing wrong?
function display_menus($menuIdPai = 0) {
    $query = mysql_query("SELECT * FROM menu WHERE menuIdPai = ".$menuIdPai) or die(mysql_error());
    if (mysql_num_rows($query) > 0) {
        echo "<ul>";
        while ($row = mysql_fetch_array($query)) {
            echo "<li> <a href='percentagem.php'>".$row['id'].$row['menuNome']."</a>";
            display_menus($row['menuId']);
            echo "</li>";
        }
        echo "</ul>";
    }
}
<ul id="nav"> 
    <?php display_menus(); ?>
</ul>
ul {
    margin: 0;
    padding: 0;
    list-style: none;
    width: 150px;
}
ul li {
    position: relative;
}
li ul {
    position: absolute;
    left: 149px;
    top: 0;
    display: none;
}
ul li a {
    display: block;
    text-decoration: none;
    color: #E2144A;
    background: #fff;
    padding: 5px;
    border: 1px solid #ccc;
}
li:hover ul {
    display: block;
}
 
    