html - Cannot override padding in print style when transition-duration is set -
i have peculiar problem seems affect chrome (tested in chromium 47.0.2526.73 on ubuntu, chrome 48.0.2564.82 m on windows, firefox 43.0.4 on ubuntu), , in actual print-preview (the problem not occur when emulating print media in developer tools).
i have been trying fix issue print styles in gitlab, in there undesirable gap on left-hand side of page, shown below.
now, 1 expect easy fix. main container element has padding-left of 230px leave room sidebar, needs 0 when printing. however, cannot print style in place eliminates padding.
i have reduced down minimal test case, shown here. i'd use in-place snippet, doesn't work when try print-preview it. source of example follows:
<!doctype html> <html> <head> <title>print style problem demonstration</title> <style type="text/css" media="all"> .page-with-sidebar { background: purple!important; transition-duration: .3s; } @media(min-width: 1199px) { .page-sidebar-expanded { padding-left: 230px; } } </style> <style type="text/css" media="print"> .page-with-sidebar, .page-sidebar-expanded { padding-left: 0!important; transition-duration: 0s!important; } </style> </head> <body> <p>i have no left padding.</p> <div class="page-sidebar-expanded page-with-sidebar"> <p style="color: white;">i should have no left padding when printed</p> </div> </body> </html>
in example, trying eliminate padding of purple p when printing setting padding-left: 0!important;
in print style. have isolated problem transition-duration: .3s;
style, , problem goes away if removed. however, setting transition-duration: 0s!important;
not override it.
i have read this thread, relevant find, solutions described not appear work me (making transition screen-only, , adding other transition: none
lines).
one further observation of interest the problem relies on @media(min-width: 1199px)
rule. if removed, problem goes away.
none of factors i've identified make problem occur changeable me in gitlab, , if i'd love know causing behaviour.
am doing wrong or bug in chrome?
the main issue transition property, can write inside media check following css, have tested , working fine.
<style type="text/css" media="all"> .page-with-sidebar { background: purple!important; } @media(min-width: 1199px) { .page-with-sidebar { transition-duration: .3s; } .page-sidebar-expanded { padding-left: 230px; } } </style> <style type="text/css" media="print"> .page-with-sidebar, .page-sidebar-expanded { padding-left: 0!important; } </style>
Comments
Post a Comment