css - 创建具有有限标准 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
解决方案
遗憾的是,这对于这组有限的 CSS 属性是不可能的。
但是您可以使用另一个库来修改现有图像并创建带有圆形边框的图像版本(并为其添加一些过滤器,基本上可以做任何您想做的事情)
编辑:由于在评论中提到了 PIL:PIL 圆边并添加边框(类似这样,另请参阅链接的问题/答案)
然后您只需在 pdf 中使用此图像,没有人会注意到任何差异。
推荐阅读
- python - 任务接收但不执行
- python - Python范围按位与边界解释
- python - 在一个变量 pyodbc 中运行多个 SQL Server 语句
- blogs - 博客文章省略 CSS
- nestjs - 具有包含 typeorm 方法的实体的种子数据库
- python-3.x - Chrome 自动化扩展程序已崩溃 - 在 Python 中使用 Selenium
- c - 如何从 Fortran 和 C 读取重定向的标准输入?(Linux/bash/gfortran/gcc)
- python - 有没有办法缩短 Mac (Python) 上的文件路径并减少数据帧?
- c - C数组在没有明显干预的情况下莫名其妙地改变了值
- r - 使用 R 的 bigrquery 库将数据追加/插入到 BigQuery 表中