css - 在 mat-icon 中设置 SVG 的 preserveAspectRatio
问题描述
我有一个带有 SVG 图像的 mat-icon:
<mat-icon [svgIcon]="getIcon()"></mat-icon>
生成的 html 看起来像这样:
<mat-icon _ngcontent-plf-c14="" class="mat-icon notranslate mat-icon-no-color" role="img" aria-hidden="true" ng-reflect-svg-icon="some-icon">
<svg width="100%" height="100%" viewBox="0 0 288 78" fill="none" xmlns="http://www.w3.org/2000/svg" fit="" focusable="false" preserveAspectRatio="xMidYMid meet">
<path d="M252 1H3L37 38.5L3 76.5H252L286.5 38.5L252 1Z" fill="#3ED8C3" stroke="#1D4477" stroke-width="2"></path>
</svg>
</mat-icon>
除了 preserveAspectRatio 位之外,所有这些都很好。Angular 总是插入
preserveAspectRatio="xMidYMid meet"
进入 SVG 但我想要
preserveAspectRatio="none"
我不知道如何得到它。
HTML 或 CSS 是否有某种方法可以更改 mat-icon 内生成的 SVG 的 preserveAspectRatio 属性?
解决方案
推荐阅读
- arrays - CodeIgniter:模型变量中未定义的索引
- python - 为python生成整数中的所有数字,除了最后一个
- javascript - 错误:{“消息”:“sqlite3_prepare_v2 失败:靠近 \“id\”:语法错误“,”代码“:5}
- angular - 如何将 PrimeIcons 与表格/网格分页器一起使用
- android - 前几天我试图为我的回收站视图添加 api 分页。但是我遇到了这样的问题
- ios - Obj-C - MKMapView 注释标注未在点击时显示?
- wildfly - 在 Wildfly 中关闭远程命名服务
- python - 只找到没有孩子的轮廓
- laravel - Laravel 5.5 错误 405(不允许方法)XHR PUT METHOD 现在在 Azure 服务器上工作
- bash - 计算 IF 进程,有什么问题?