2016-05-21 19 views
1

Ich verwende DOMPDF, um eine Rechnung zu erstellen. Ich muss ein paar divs Seite an Seite haben. Das Float-Element funktioniert nicht. Ich versuche, Spalte 2 neben Spalte 1DOMPDF haben zwei Divs nebeneinander? PHP

<?php 
require_once "dompdf/dompdf_config.inc.php"; 

$dompdf = new DOMPDF(); 

$html =' 
<html> 
<link type="text/css" href="pdf.css" rel="stylesheet"/> 
<body> 

<div class="columns"> 
    <div class="red" >Column 1</div> 
    <div class="grey">Column 2</div> 
    <div class="red" >Column 3</div> 
</div> 
<div class="clear"></div> 

</body> 
</html> 
'; 

$dompdf->load_html($html); 
$dompdf->render(); 

//$dompdf->stream("hello.pdf"); 

$dompdf->stream('my.pdf',array('Attachment'=>0)); 

?> 

Below zu bekommen, ist die CSS

div.columns  { width: 50%; } 
div.columns div { width: 50%; height: 100px; float: left; } 
div.grey   { background-color: #cccccc; } 
div.red   { background-color: #e14e32; } 
div.clear   { clear: both; } 

Antwort