0

trying to write "div" tag after the "a" but whenever I check this piece of code by viewing source, it is automatically replaced with "span". I am using HTML5 and checking this code in firefox 42. nd I had already checked it in html validator.

<a href="services.php" class="list-group-item block-active"> Services 
    <div class="icon-parent">
        <div class="default-block text-center other-bg block-active">
            <span class="fa-stack fa-lg">
                <i class="fa fa-code-fork fa-stack-1x"></i>
                <i class="fa fa-wrench fa-stack-1x"></i>
            </span>
        </div>
    </div>
</a>

3 Answers3

0

Run your HTML through a validator.

The a element is an in-line element that can't hold block level elements. Without knowing the browser and doctype, an exact answer can't be given because different browsers are allowed to auto-correct bad HTML4 however they want.

HTML5 should be standardized.

Jeremy J Starcher
  • 23,369
  • 6
  • 54
  • 74
0

Problem Solved now! Thanks everyone for your suggestion, we were struggling on this error from last 3 days but solution was very simpe, an inner ending span was missing which causes this error.

-1

You shouldn't nest divs within an anchor.

<ul class="list-group">
    <li class="list-group-item">
        <a href="services.php">Services</a>
        <!-- your icon stuff here -->
    </li>
</ul>
Tim Sheehan
  • 3,994
  • 1
  • 15
  • 18