简体   繁体   中英

how to overwrite inline styles in print css?

i know, inline styles are "evil", but there are inserted in html with javascript (jQuery animation). so, is it possible?

This:

  <div style="background: red;">
        The inline styles for this div should make it red.
    </div>

Can be overridden with:

div[style] {
   background: yellow !important;
}

You can add !important to any css property

Try putting !important between the value and the semi-colon in your print stylesheet:

body {
    background-color: #0f0 !important;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM