Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a css rule override jQuery .css changes

I have two stylesheets: a media="print" one and a media="screen" one. I also have some jQuery code that runs on window resize, changing the margin-left of a div.

Currently, this div is way off to the right when the user prints. I want the margin-left to always be zero when the user prints.

How could I go about doing this? Thanks in advance!

like image 929
JJJollyjim Avatar asked Apr 10 '12 21:04

JJJollyjim


2 Answers

Give it an id and set it to #your-id { margin-left: whatever !important; }

like image 174
Jamund Ferguson Avatar answered Oct 17 '22 21:10

Jamund Ferguson


Using !important in your CSS stylesheet is one option.

Another option might be removing the inline style attribute, and then adding your own using removeAttr('style').

like image 44
Evan Avatar answered Oct 17 '22 23:10

Evan