在mPDF上渲染CSS的问题 - PHP

问题描述 投票:0回答:1

好的。

这个问题有点奇怪。

我正在尝试将HTML页面转换为PDF文件并保存。

我正在使用mPDF。但是,CSS渲染没有按预期进行。

我没有使用CSS3。所以,我认为这不是问题所在。

这是一个屏幕截图,它应该是怎样的:

enter image description here

PDF:

Goes really wrong

提前致谢。

HTML:https://codepen.io/AKhaled47/pen/omRObM

CSS:

div.calendar{
  margin:2pc auto;
  padding:0px;
  width:602px;
}
div.calendar div.box{
    position:relative;
    top:0px;
    left:0px;
    width:100%;
    height:40px;
    background-color:#890e4f;    
    border-radius: 5px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;  
}
div.calendar div.header{
    line-height:40px;  
    vertical-align:middle;
    position:absolute;
    left:11px;
    top:0px;
    width:582px;
    height:40px;   
    text-align:center;
}
div.calendar div.header a.prev,div.calendar div.header a.next{ 
    position:absolute;
    top:0px;   
    height: 17px;
    display:block;
    cursor:pointer;
    text-decoration:none;
    color:#FFF;
}
div.calendar div.header span.title{
    color:#FFF;
    font-size:18px;
}
div.calendar div.header a.prev{
    left:0px;
}
div.calendar div.header a.next{
    right:0px;
}
div.calendar div.box-content{
    background: #FFF;
    border:1px solid #890e4f;
    border-top:none;
    border-radius:5px;
    border-top-left-radius:0;
    border-top-right-radius:0;
}
div.calendar ul.label{
    float:left;
    margin: 0px;
    padding: 0px;
    margin-top:5px;
    margin-left: 5px;
}
div.calendar ul.label li{
    margin:0px;
    padding:0px;
    margin-right:5px;  
    float:left;
    list-style-type:none;
    width:80px;
    height:40px;
    line-height:40px;
    vertical-align:middle;
    text-align:center;
    color:#000;
    font-size: 15px;
    background-color: transparent;
}
div.calendar ul.dates{
    float:left;
    margin: 0px;
    padding: 0px;
    margin-left: 5px;
    margin-bottom: 5px;
}
div.calendar ul.dates li{
    margin:0px;
    padding:0px;
    margin-right:5px;
    margin-top: 5px;
    line-height:80px;
    vertical-align:middle;
    float:left;
    list-style-type:none;
    width:80px;
    height:80px;
    font-size:25px;
    background-color: #DDD;
    color:#000;
    text-align:center; 
}
:focus{
    outline:none;
}
div.clear{
    clear:both;
}
php html css mpdf html-to-pdf
1个回答
1
投票

mPDF仅部分支持浮点元素。为获得最佳效果,请使用HTML表格(非常适合日历)。

请参阅浮点数文档:https://mpdf.github.io/what-else-can-i-do/floating-blocks.html

© www.soinside.com 2019 - 2024. All rights reserved.