Duc Tran
Duc Tran

Reputation: 6294

How to implement block link inside span tag?

I've read how to implement block link from this source: http://green-beast.com/blog/?p=74 However, I don't know how to apply it to tag located inside tag. As my html code is following this format:

<li class="">
    <span>
        <strong>
           <a href="#">Text</a>
        </strong>
        <span class="Count">Number</span>
    </span>
</li>

Upvotes: 0

Views: 3131

Answers (1)

Sean
Sean

Reputation: 650

A <span> is an inline element, so it should not contain a block link. This is because inline elements should never contain block elements. Try this HTML (removed <span>):

<li class="myList">
    <strong>
       <a href="#">Text</a>
    </strong>
    <span class="Count">Number</span>
</li>

And CSS:

li.myList strong a { display:block; }

If anything there looks confusing, you might want to do some reading of "CSS selectors" and "inline and block elements in css".

Upvotes: 3

Related Questions