rd42
rd42

Reputation: 3594

jquery margin top

I have margin-top defined in the css for the page and I've tried margin-top, marginTop, '250', '250px' and the margin continues to be non-existent when I try to alter it. Any ideas?

$("#content-bottom-left").css({'margin-top':'250px'});

The full code is in this jsfiddle here.

Upvotes: 0

Views: 2795

Answers (1)

Andreas Wong
Andreas Wong

Reputation: 60516

It's because you are wrapping your <img> in a span which is an inline element and doesn't respect block element stuff like margin-*

http://jsfiddle.net/wE5n7/1/

One solution is to change the wrappers to div and use float:left on each

Upvotes: 1

Related Questions