如何在mpdf中居中放置图像? [英] How can I center image in mpdf?

查看:100
本文介绍了如何在mpdf中居中放置图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将图像放在 mpdf (版本6>)中.

I would like to centre image in mpdf (version 6>).

这是我发送给mpdf的(缩短的)html输出. displayed 类没有帮助.

This is my (shortened) html output that I send to mpdf. The displayed class does not help.

<style>
IMG.displayed {
    display: block;
    margin-left: auto;
    margin-right: auto }
</style>

<img style="max-height:600px" class="displayed" src="/images/size_original/m_princezna_1.jpg"/>

推荐答案

在图像的父HTML元素上添加 text-align:center 属性,例如:

Add a text-align: center property on a parent HTML element of the image, eg.:

body { text-align: center }

这篇关于如何在mpdf中居中放置图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆