首页 > 解决方案 > 创建具有有限标准 CSS 属性的圆形图像?

问题描述

是否可以使用一组有限的 CSS 属性创建圆形图像?我正在使用 python 的xhtml2pdf,它只支持一些 CSS 属性。

唯一可用的 CSS 属性是:

background-color
border-bottom-color, border-bottom-style, border-bottom-width
border-left-color, border-left-style, border-left-width
border-right-color, border-right-style, border-right-width
border-top-color, border-top-style, border-top-width
colordisplay
font-family, font-size, font-style, font-weight
height
line-height, list-style-type
margin-bottom, margin-left, margin-right, margin-top
padding-bottom, padding-left, padding-right, padding-top
page-break-after, page-break-before
size
text-align, text-decoration, text-indent
vertical-align
white-space
width
zoom

标签: cssxhtml2pdf

解决方案


遗憾的是,这对于这组有限的 CSS 属性是不可能的。

但是您可以使用另一个库来修改现有图像并创建带有圆形边框的图像版本(并为其添加一些过滤器,基本上可以做任何您想做的事情)

编辑:由于在评论中提到了 PIL:PIL 圆边并添加边框(类似这样,另请参阅链接的问题/答案)

然后您只需在 pdf 中使用此图像,没有人会注意到任何差异。


推荐阅读