Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to override left:0 using CSS or Jquery?

I have an element, which has the following CSS:

.elem {   left: 0;   position: fixed;   right: 0;   width: 60%;   z-index: 1000;   } 

The element does not span the whole screen. I would like it to "align" to the right hand side of the screen.

This would be easy, if I just removed left: 0, but I cannot tamper with the above CSS, so I need some CSS or Jquery to override, disable or remove the left:0 CSS.

Thanks for help!

like image 571
frequent Avatar asked Apr 11 '12 09:04

frequent


People also ask

How do I override left in CSS?

The default value for left is auto , so just set it to that and you will "reset" it. Make sure that the above comes after the original CSS file. THANKS!

Can jQuery override CSS?

cssHooks. Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.


2 Answers

The default value for left is auto, so just set it to that and you will "reset" it.

.elem {   left: auto; } 

Make sure that the above comes after the original CSS file.

like image 174
Jan Hančič Avatar answered Sep 24 '22 02:09

Jan Hančič


Using CSS:

.elem {     left: auto; } 

Using JQuery:

$(".elem").css("left", "auto"); 
like image 30
Mohammad Anini Avatar answered Sep 26 '22 02:09

Mohammad Anini