CKTIS / CSS
shape-image-threshold — limiar alfa de uma forma de contorno
shape-image-threshold seleciona os píxeis da imagem utilizados para determinar a área que o texto evita em torno de um elemento flutuante.
Versão: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Sintaxe
shape-image-threshold: <opacity-value>;shape-image-threshold funciona com uma imagem em shape-outside: a forma inclui os píxeis cujo valor alfa é estritamente superior ao limiar. Não recorta a imagem nem altera o seu aspeto visível; também não controla uma forma circle().
O valor inicial é 0; a propriedade não é herdada. Os números fora de [0,1] são limitados aos extremos desse intervalo. Com 1, a forma fica vazia, pois nenhum píxel tem um valor alfa superior.
O exemplo utiliza um gradiente sem recursos externos. O limiar 0.5 seleciona a sua metade esquerda opaca.
Exemplos
<!doctype html>
<meta charset="utf-8">
<title>shape-image-threshold</title>
<style>
.demo { width: 320px; display: flow-root; font: 16px/24px monospace; }
.shape {
float: left;
width: 160px;
height: 120px;
shape-outside: linear-gradient(to right, #000 80px, transparent 80px);
shape-image-threshold: 0.5;
}
p { margin: 0; }
</style>
<div class="demo">
<div class="shape" aria-hidden="true"></div>
<p>Alpha defines the wrapping area. Alpha defines the wrapping area. Alpha defines the wrapping area. Alpha defines the wrapping area. Alpha defines the wrapping area.</p>
</div>Resultado
Expected: text beside the float starts 80px from the container's left edge, rather than 160px. With shape-image-threshold: 1, the shape is empty and text starts at the left edge.
O código apresentado e o resultado declarado foram verificados num ambiente isolado pelo método registado na prova de verificação desta versão exata.