float: left – anchor’s height

Today I faced a strange problem …. I have to add drop-down menu by javascript.

<a href=”https://www.svnlabs.com” style=”border:2px dotted #0000FF”><img src=”svnlabs.gif” border=”0″ style=”border:2px solid #009966″ /></a>

this is the code where I have to add a menu but menu dancing on this image.. when I mouse over the image menu appeared to bottom of the image…

anchor height

here you can see output of above html code… I have marked a border around image in green and on anchor with blue color.

I think now you got the problem 🙂

Yes, now we have to apply height and width to anchor in blue color below is the code for this….

<a href=”https://www.svnlabs.com” style=”border:2px dotted #0000FF; float:left; width:70px; height:80px;”><img src=”dateblock.gif” border=”0″ style=”border:2px solid #009966″ /></a>

This is the magic for “float: left” of CSS .. here you can use “float: right” as well to apply height/width to anchor tags…..

height of anchor
Here you can see the output of above code the blue border with width/height of anchor tag.