Skip to content

CSS: img ​

.instui-img — 带有可叠加的显示、裁剪和效果修饰符的样式化 <img>。

效果通过共享的 --pantoken-img-filter 自定义属性合成,因此 -with-grayscale 和 -with-blur 可以同时应用;-constrain-* 裁剪修饰符要求使用者明确设置容器尺寸。

Source: img.css

无障碍 ​

为 alt 提供描述图像的有意义文本;对于纯装饰性图像使用空的 alt="",以便辅助技术跳过它们。

用法 ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/img.css";

示例 ​

html
<img class="instui-img" alt="Gradient">

修饰符 ​

修饰符描述
.-constrain-contain按比例缩放以适应容器(contain)。
.-constrain-cover按比例缩放以填满容器(cover)。
.-display-block作为块级元素显示。
.-with-blur应用模糊效果。
.-with-grayscale应用灰度效果。

自定义属性 ​

属性类型默认描述
--pantoken-img——filter <filter-value-list> | none — 图像上合成的 CSS 过滤器;效果修饰符会设置它,您可以覆盖该值以使用自定义过滤器。

消耗代币 ​

Token类型值
--instui-component-img-effect-transition-duration<time>1s
--instui-component-img-image-blur-amount<length>0.25em
--pantoken-img-filternone | <filter-value-list> | <-ms-filter-function-list>none