Php puts <h5> tag into wrong way

275 views Asked by At

I have this code, that generates the menu from sql.

<footer class="footer-basic-centered">
  <p class="footer-links">
    <?php 
    $top_menuDown = mysqli_query($kapcs, "SELECT * FROM top_menu WHERE latszik = 1 AND (top_menu_place = 1 OR top_menu_place = 0) ORDER BY top_menu_sorrend ASC");
    if(mysqli_num_rows($top_menuDown) > 0 )
    {
        while($top_nav = mysqli_fetch_assoc($top_menuDown))
        {
            echo '<a class="footer_menu_to_link" href="'.$host.'/'.$top_nav['top_menu_seo'].'" title="'.$top_nav['top_menu_nev'].'"><h5 class="kat_h5">'.$top_nav['top_menu_nev'].'</h5></a>'."\n";
        }
    }
    ?>
  </p>
  <h6 class="copy"><p class="footer-company-name"><?php echo date("Y"); ?> <?php echo $siteName; ?> &copy;  - Minden jog fentartva!</p></h6>
</footer>

As you can see it on the image i uploaded, at the first link, the <h5> tag is outside the <a>. The other links are okay.

Whats going on there?

enter image description here

1

There are 1 answers

1
jeroen On BEST ANSWER

You are putting a h5 in an a that is in a p. That is not going to do what you think.

The p will get closed automatically when you add a new block-level element like a h5.