Forums

CSS for admin-bar stops pages printing correctly (1 post)

  1. JohnP
    Member
    Posted 1 year ago #

    From what I can see, any front-facing page displaying the new admin-bar will print with a 28px margin-top on html, resulting in the last line of each page being obscured.

    This happens even with all other styles disabled.

    I tried making a function to insert a media="print" style into the head, but it ends up ahead of the problem CSS ie:
    html { margin-top: 28px !important; } and so gets overwritten.

    Then I found a function which will successfully remove just the offending code:
    add_theme_support( 'admin-bar', array( 'callback' => '__return_false') );

    ...and everything is still working fine! I can remove all the extra styles I made to fix my absolutely positioned elements.

    I don't understand why is this CSS being inserted at all. If it does have a purpose, why not add media="screen"?

    Has anybody else noticed that pages will not print properly when the admin-bar is present?

Topic Closed

This topic has been closed to new replies.

About this Topic