Skip to content Skip to sidebar Skip to footer

Fluid Spacing For A Div

I have a page that features a main image. The main image will change its height and width depending on the photo. I also have an AddThis sharing widget next to the image. I have th

Solution 1:

You could add some JavaScript to the image tag like this:

<imgonload="onMyImageLoad(this)" />

and then elsewhere in your document place:

<script>functiononMyImageLoad( img )
{

var height = img.height// now do something with this height value like change a // div's height or margin-top    

}

</script>

Solution 2:

Here is how I have done this but my image is no longer centered on the page. Working on that one...

<divstyle="min-height:100px; min-width:100px; position:relative; float:left; "><divstyle="text-align:center;"><imgsrc="/Images/test.jpg"alt="test" /></div><divstyle="position:absolute; bottom:0px; right:-40px;"><divclass="addthis_toolbox addthis_floating_style addthis_16x16_style"><aclass="addthis_button_facebook"></a><aclass="addthis_button_twitter"></a><aclass="addthis_button_email"></a><aclass="addthis_button_compact"></a></div><scripttype="text/javascript"src="http://s7.addthis.com/js/300/
            addthis_widget.js"></script></div></div>

Post a Comment for "Fluid Spacing For A Div"