Search code examples
cssprintingalignment

CSS print issue, title aligns right


I have my CV page at https://abiusx.com/cv , I want to modify it so that when user wants to print, menus are not visible but headers are.

The problem is, on the printed page (PDF) the title (AbiusX) and subtitle are automatically aligned to the right of the page, and it is really annoying me. No matter what I do with the css, it goes there on the print.


Solution

  • add this inside your @media print

    h1.author { 
              text-align:center; 
              margin:auto; 
              margin-top:5px; 
    }
    

    Your css default media appears as screen when i check it with firebug and chrome developer tools, so i think when its processed to be printed the h1.author definition is omited.

    the resulting @media print you should have is:

    /* print media */
     @media print {
    .noprint {
        display:none;
    }
        h1.author {
            text-align:center;
            margin:auto;
            margin-top:5px;
        }
    }