@page { @bottom-cente...">

Apply margin to CSS position

I use the following CSS to place the footer at the bottom of the page:

<style type="text/css"> @page { @bottom-center { content: element(footer); } } #footer {position: running(footer);} </style> 

Is there a way to display it just above? Adding margin-bottom: 50px doesn't seem to have an effect.

: The page will be converted to PDF using iText

+4
source share
2 answers

I finally managed to get it to work with the following CSS:

  <style type="text/css"> @page { margin-bottom: 100px; @bottom-center { content:element(footer); } } #footer { position: running(footer); } </style> 

I used to just try to add margin-bottom to the bottom center of @ and #footer.

+4
source

To achieve this, you usually use:

 #footer { position: absolute; bottom: 50px; } 

JsFiddle example

0
source

Source: https://habr.com/ru/post/1369179/


All Articles