Positioning background image on page header

Post here questions and problems related to editing and publishing DITA content.
SunilCP
Posts: 10
Joined: Wed Jan 04, 2023 8:44 am

Positioning background image on page header

Post by SunilCP »

I am trying to position a background image on the page header. This is for the customized PDF header.

Code: Select all

    margin-top: 2cm;  
    margin-bottom: 1.5cm;
    margin-left: 1.06cm;
    margin-right: 0.81cm; 
@top-left{
    content: " ";
    background-image: url(../images/Reference.png);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% 100%;
}
I want the background image 1 cm from the top margin. But, the background image is always aligned to the top of the margin with 0 cm.

Any thoughts on how to adjust the background image within the available page margin of 2 cm.
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Positioning background image on page header

Post by julien_lacour »

Hello,

If you want your background-image to start 1cm from the top of the page, you need to change the background-position values:

Code: Select all

background-position: 0 1cm;
Where the first value is the X axis (from the left) and the second is the Y axis (from the top).

Regards,
Julien
SunilCP
Posts: 10
Joined: Wed Jan 04, 2023 8:44 am

Re: Positioning background image on page header

Post by SunilCP »

Thanks a lot. It really helps.
Post Reply