I have an a div with position:absolute
. I'm trying to position it to right using jQuery but it's not working. In the code below i'm basically removing left and adding right:0. This should position the div to far right. using firebug, i can see the inline style being changed to right:0
but nothing is happening. What am i doing wrong. Check http://jsfiddle.net/SJP3b/1/
$('div').css({
left: '',
right: 0
});
Use left:'auto'
that works for me:
http://jsfiddle.net/SJP3b/2/
Many values can't be set to blank. So you have to set them to their default css value.
That's auto
for the left
attribute:
http://www.w3schools.com/css/pr_pos_left.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With