Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery CSS position right not working

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
});
like image 379
Pinkie Avatar asked May 20 '11 07:05

Pinkie


1 Answers

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

like image 128
jantimon Avatar answered Nov 05 '22 02:11

jantimon