Have you set viewport:
<meta name="viewport" content="width=device-width, initial-scale=1">
And decrease main div width some to allow for printer margins.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have print pdf using dompdf and i use basic html but , i have a problem on paper on right side , my colomn is out of paper like this picture
or on this link image . this image showed colomn and this left is correctly but on this right its out of range . i need to create like this left side but i dont know.
its my code :
CSS
<style>
* {
box-sizing: border-box;
}
/* Create two equal columns that floats next to each other */
.columnA {
float: left;
width: 68.7%;
padding: 10px;
height: 200px; /* Should be removed. Only for demonstration */
border: 1px solid black;
}
.columnB {
float: left;
width: 68.7%;
padding: 10px;
height: 120px; /* Should be removed. Only for demonstration */
border: 1px solid black;
}
.columnC {
float: left;
width: 33.3%;
padding: 10px;
height: 200px; /* Should be removed. Only for demonstration */
border: 1px solid black;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
</style>
Colomn
<div class="row">
<div class="columnA" style="background-color:white;">
<h2>Column 1</h2>
<p>Some text..</p>
</div>
<div class="columnA" style="background-color:white;">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
</div>
<div class="row">
<div class="columnB" style="background-color:white;">
<h2>Column 1</h2>
<p>Some text..</p>
</div>
<div class="columnB" style="background-color:white;">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
</div>
<div class="row">
<div class="columnC" style="background-color:white;">
<h2>Column 1</h2>
<p>Some text..</p>
</div>
<div class="columnC" style="background-color:white;">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
<div class="columnC" style="background-color:white;">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
</div>
i try this change this css float its make change the posisition but i can do correctly , if i change this float 50% its will create space on this right correctly but i dont need 50% my case is 68,7%, can someone help ?
Please or to participate in this conversation.