danfickle / danfickle/openhtmltopdf

Padding/ Margin values with relative units not working

Open
#145 1 comment 0 reactions 1 assignee Claimed by @danfickle View on GitHub
has failing test
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

Hi Dan,

If padding/ margin values are provided in percentage(%) value, then no padding/ margin is getting applied. The actual HTML gives the appropriate padding/ margin. Is there any alternative/ fix for this?

```



@page
{
size:8.5in 11in portrait;
margin-left: 10px;
margin-right:15px;
margin-top:10px;
margin-bottom: 0;
}
body
{
height: 11in;
width: 8.5in;
display: block;
page-break-after: always;
margin-top: 0px;
position: relative;
}
.parent
{
display: table;
padding : 10%;
width: 99.95%;
}
.tableHead
{
display: table-row;
border: 1px solid black;
}
.tableHead span
{
display: table-cell;
width: 1px;
white-space: nowrap;
word-break: break-word;
text-align: center;
border-bottom: 1px solid black;
border-right: 1px solid black;
}





CODE
DESCRIPTION
QTY
PRICE CS
PRICE IP
PRICE PC
AMOUNT DUE


```

Here I have provided 10% padding to the .parent div, it is not getting applied. Please help!!
Below is the output when I provide padding in percentage.
![capture](https://user-images.githubusercontent.com/6688232/31941032-e6273826-b8dd-11e7-9f0a-3c8b2c7820c5.PNG)

Below is the output when I provide padding in pixels(NOTE: When I use absolute CSS units, it works fine. But I don't want to use absolute units, instead I want to use relative units)
![capture1](https://user-images.githubusercontent.com/6688232/31941033-e662cdfa-b8dd-11e7-8557-9fc73e364836.PNG)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.