Question

I have a HTML like this:

<a class="nhr" href="javascript:void(0)" onclick="" >
    <p class="top_dr_profle">
        <div class="my_doc_pic">
            <img src="images/profile_img.png" />
        </div>
        <div class="my_doc_cont">
            <p>Josh Dobstaff, MD</p>
            <p>Hospitalist</p>
        </div>
        <div class="clear"></div>
    </p>
    <p class="primary">Make Primary</p>
</a>

Here you can see 3 <div/>s inside <p/> tag with class .top_dr_profle. But when I see it in firebug in mozilla the <div/>s are appearing outside of the <p/> tags. I have attached the screen shot too of firebug.

enter image description here

Was it helpful?

Solution

Use a validator.

<p> elements may not have <div> element child nodes.

OTHER TIPS

paragraph tag can not contain block level elements. div is a block level element

You can use a span element inside parapragh elements so it would look like this:

<p class="top_dr_profle">
    <span class="my_doc_pic">
        <img src="images/profile_img.png" />
    </span>
</p>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top