Base di conoscenzaCentro esami
ITItaliano
Scegli la lingua13

CKTIS / CSS

corner-right-shape — forma degli angoli destri

Una proprietà abbreviata CSS che imposta la forma degli angoli superiore destro e inferiore destro senza modificarne i raggi.

Versione: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Sintassi

corner-right-shape: <'corner-top-left-shape'>{1,2};
<corner-shape-value> = round | scoop | bevel | notch | square | squircle | superellipse(<number> | infinity | -infinity)

corner-right-shape imposta corner-top-right-shape e corner-bottom-right-shape, nell’ordine dall’alto verso il basso. Un solo valore imposta entrambi gli angoli. Si riferisce al lato fisico destro, indipendentemente dalla direzione di scrittura.

I raggi sono determinati da border-radius; con un raggio pari a zero non si produce alcun effetto visibile sulla forma. La forma iniziale è round; le proprietà non sono ereditate.

Questa funzionalità è descritta in una bozza del CSSWG. Il solo ambito di Chromium 152 non ne conferma il supporto; l’esempio richiede una verifica locale.

Esempi

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Right corner shape shorthand</title>
  <style>
    #tile {
      width: 160px;
      height: 100px;
      background: teal;
      border-radius: 0 24px 24px 0;
      corner-right-shape: bevel round;
    }
  </style>
</head>
<body>
  <div id="tile" role="img" aria-label="Teal sample tile" aria-describedby="status"></div>
  <p id="status" role="status"></p>
  <p>The declaration requests a bevel at the top right and a rounded corner at the bottom right.</p>
  <script>
    const supported = CSS.supports('corner-right-shape', 'bevel round');
    const style = getComputedStyle(document.getElementById('tile'));
    const topShape = style.getPropertyValue('corner-top-right-shape');
    const bottomShape = style.getPropertyValue('corner-bottom-right-shape');
    const radiiUnchanged = style.borderTopRightRadius === '24px' && style.borderBottomRightRadius === '24px';
    const ok = radiiUnchanged && (supported
      ? (topShape === 'bevel' || topShape === 'superellipse(0)') && (bottomShape === 'round' || bottomShape === 'superellipse(1)')
      : (topShape === '' || topShape === 'round') && (bottomShape === '' || bottomShape === 'round'));
    document.getElementById('status').textContent = supported
      ? `Supported. Computed top-right shape: ${topShape}; bottom-right shape: ${bottomShape}.`
      : 'Unsupported. Both right corners use their rounded border-radius fallback.';
    console.log(`Right corner shorthand check: ${ok ? 'PASS' : 'FAIL'}`);
  </script>
</body>
</html>

Risultato

Right corner shorthand check: PASS

Il codice mostrato e il risultato dichiarato sono stati verificati in un ambiente isolato con il metodo registrato nella prova di verifica di questa versione esatta.

Fonti